Revision 5b88f807
Added by Andreas Müller over 7 years ago
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/sdd/ikeyplus/IkeyPlusImport.java | ||
---|---|---|
29 | 29 |
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode; |
30 | 30 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
31 | 31 |
import eu.etaxonomy.cdm.model.name.Rank; |
32 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
|
32 | 33 |
import fr.lis.ikeyplus.IO.SDDSaxParser; |
33 | 34 |
import fr.lis.ikeyplus.model.DataSet; |
34 | 35 |
import fr.lis.ikeyplus.model.ICharacter; |
... | ... | |
172 | 173 |
pkNode = createPkNode(null, statement); |
173 | 174 |
|
174 | 175 |
//TODO handle rank |
175 |
NonViralName<?> nonViralName = NonViralName.NewInstance(Rank.UNKNOWN_RANK());
|
|
176 |
NonViralName<?> nonViralName = TaxonNameBase.NewNonViralInstance(Rank.UNKNOWN_RANK());
|
|
176 | 177 |
nonViralName.setTitleCache(taxon.getName(), true); |
177 | 178 |
eu.etaxonomy.cdm.model.taxon.Taxon cdmTaxon = eu.etaxonomy.cdm.model.taxon.Taxon.NewInstance( |
178 | 179 |
nonViralName, null); //FIXME !!!!!! |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/sdd/in/SDDImport.java | ||
---|---|---|
918 | 918 |
|
919 | 919 |
NonViralName<?> tnb = null; |
920 | 920 |
if (!id.equals("")) { |
921 |
tnb = NonViralName.NewInstance(defaultRank);
|
|
921 |
tnb = TaxonNameBase.NewNonViralInstance(defaultRank);
|
|
922 | 922 |
IdentifiableSource source = null; |
923 | 923 |
if (isNotBlank(uri)) { |
924 | 924 |
//TODO type |
... | ... | |
1223 | 1223 |
private Taxon handleCDNoScope(Namespace sddNamespace, |
1224 | 1224 |
SDDImportState cdmState, Element elCodedDescription ) { |
1225 | 1225 |
Taxon taxon = null; |
1226 |
NonViralName<?> nonViralName = NonViralName.NewInstance(defaultRank);
|
|
1226 |
NonViralName<?> nonViralName = TaxonNameBase.NewNonViralInstance(defaultRank);
|
|
1227 | 1227 |
String id = new String("" + taxonNamesCount); |
1228 | 1228 |
IdentifiableSource source = IdentifiableSource.NewDataImportInstance(id, "TaxonName"); |
1229 | 1229 |
importRepresentation(elCodedDescription, sddNamespace, nonViralName, id, cdmState); |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/specimen/excel/in/SpecimenCdmExcelImport.java | ||
---|---|---|
506 | 506 |
if (nc != null){ |
507 | 507 |
name = nc.getNewTaxonNameInstance(rank); |
508 | 508 |
}else{ |
509 |
name = NonViralName.NewInstance(rank);
|
|
509 |
name = TaxonNameBase.NewNonViralInstance(rank);
|
|
510 | 510 |
} |
511 | 511 |
if (StringUtils.isNotBlank(commonDetermination.genus)){ |
512 | 512 |
name.setGenusOrUninomial(commonDetermination.genus); |
... | ... | |
644 | 644 |
* @return |
645 | 645 |
*/ |
646 | 646 |
private NonViralName<?> makeTaxonName(SpecimenCdmExcelImportState state, DeterminationLight determinationLight) { |
647 |
NonViralName<?> name = NonViralName.NewInstance(null);
|
|
647 |
NonViralName<?> name = TaxonNameBase.NewNonViralInstance(null);
|
|
648 | 648 |
NomenclaturalCode nc = state.getConfig().getNomenclaturalCode(); |
649 | 649 |
if (nc != null){ |
650 | 650 |
name = (NonViralName<?>)nc.getNewTaxonNameInstance(null); |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/specimen/excel/in/SpecimenSythesysExcelImport.java | ||
---|---|---|
50 | 50 |
import eu.etaxonomy.cdm.model.media.Media; |
51 | 51 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
52 | 52 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
53 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
|
53 | 54 |
import eu.etaxonomy.cdm.model.occurrence.Collection; |
54 | 55 |
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit; |
55 | 56 |
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent; |
... | ... | |
450 | 451 |
taxonName = parseScientificName(scientificName); |
451 | 452 |
} |
452 | 453 |
else{ |
453 |
taxonName = NonViralName.NewInstance(null);
|
|
454 |
taxonName = TaxonNameBase.NewNonViralInstance(null);
|
|
454 | 455 |
taxonName.setTitleCache(scientificName, true); |
455 | 456 |
} |
456 | 457 |
getNameService().save(taxonName); |
... | ... | |
520 | 521 |
} |
521 | 522 |
|
522 | 523 |
if(nomenclatureCode == null){ |
523 |
taxonName = NonViralName.NewInstance(null);
|
|
524 |
taxonName = TaxonNameBase.NewNonViralInstance(null);
|
|
524 | 525 |
taxonName.setTitleCache(scientificName, true); |
525 | 526 |
return taxonName; |
526 | 527 |
} |
... | ... | |
555 | 556 |
// } |
556 | 557 |
//TODO: parsing of ViralNames? |
557 | 558 |
if(problem){ |
558 |
taxonName = NonViralName.NewInstance(null);
|
|
559 |
taxonName = TaxonNameBase.NewNonViralInstance(null);
|
|
559 | 560 |
taxonName.setTitleCache(scientificName, true); |
560 | 561 |
} |
561 | 562 |
return taxonName; |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/tcsxml/in/TcsXmlTaxonNameImport.java | ||
---|---|---|
290 | 290 |
if (nomCode != null){ |
291 | 291 |
nameBase = nomCode.getNewTaxonNameInstance(rank); |
292 | 292 |
}else{ |
293 |
nameBase = NonViralName.NewInstance(rank);
|
|
293 |
nameBase = TaxonNameBase.NewNonViralInstance(rank);
|
|
294 | 294 |
} |
295 | 295 |
childName = "Simple"; |
296 | 296 |
obligatory = true; |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/tcsxml/in/TcsXmlTaxonRelationsImport.java | ||
---|---|---|
36 | 36 |
import eu.etaxonomy.cdm.model.common.RelationshipTermBase; |
37 | 37 |
import eu.etaxonomy.cdm.model.description.CommonTaxonName; |
38 | 38 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
39 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
|
40 | 39 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
41 | 40 |
import eu.etaxonomy.cdm.model.reference.Reference; |
42 | 41 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
... | ... | |
214 | 213 |
|
215 | 214 |
|
216 | 215 |
} else{ |
217 |
basionymName = NonViralName.NewInstance(name.getRank());
|
|
216 |
basionymName = TaxonNameBase.NewNonViralInstance(name.getRank());
|
|
218 | 217 |
childName = "RelatedName"; |
219 | 218 |
obligatory = true; |
220 | 219 |
Element elName = XmlHelp.getSingleChildElement(success, elBasionym, childName, tcsNamespace, obligatory); |
... | ... | |
544 | 543 |
}else{ |
545 | 544 |
String title = elToTaxonConcept.getTextNormalize(); |
546 | 545 |
//TODO synonym? |
547 |
TaxonNameBase<?,?> taxonName = NonViralName.NewInstance(null);
|
|
546 |
TaxonNameBase<?,?> taxonName = TaxonNameBase.NewNonViralInstance(null);
|
|
548 | 547 |
taxonName.setTitleCache(title, true); |
549 | 548 |
logger.warn("Free text related taxon seems to be bug in TCS"); |
550 | 549 |
if (isSynonym){ |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/NonViralName.java | ||
---|---|---|
60 | 60 |
extends TaxonNameBase<T, INonViralNameCacheStrategy> |
61 | 61 |
implements INonViralName{ |
62 | 62 |
|
63 |
private static final long serialVersionUID = 4441110073881088033L; |
|
64 |
|
|
63 |
private static final long serialVersionUID = -9083811681449792683L; |
|
65 | 64 |
|
66 | 65 |
// ************************** CONSTRUCTORS *************/ |
67 | 66 |
|
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/TaxonNameBase.java | ||
---|---|---|
505 | 505 |
* @see eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy |
506 | 506 |
* @see eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy |
507 | 507 |
*/ |
508 |
public static NonViralName NewInstance(Rank rank){ |
|
508 |
public static NonViralName NewNonViralInstance(Rank rank){
|
|
509 | 509 |
return new NonViralName(rank, null); |
510 | 510 |
} |
511 | 511 |
|
... | ... | |
527 | 527 |
* @see eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy |
528 | 528 |
* @see eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy |
529 | 529 |
*/ |
530 |
public static NonViralName NewInstance(Rank rank, HomotypicalGroup homotypicalGroup){ |
|
530 |
public static NonViralName NewNonViralInstance(Rank rank, HomotypicalGroup homotypicalGroup){
|
|
531 | 531 |
return new NonViralName(rank, homotypicalGroup); |
532 | 532 |
} |
533 | 533 |
|
cdmlib-model/src/test/java/eu/etaxonomy/cdm/aspectj/NewEntityListenerTest.java | ||
---|---|---|
17 | 17 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
18 | 18 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
19 | 19 |
import eu.etaxonomy.cdm.model.name.Rank; |
20 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
|
20 | 21 |
|
21 | 22 |
/** |
22 | 23 |
* @author cmathew |
... | ... | |
37 | 38 |
public void testPropertyChange() { |
38 | 39 |
CdmBase.setNewEntityListener(this); |
39 | 40 |
|
40 |
NonViralName<?> b = NonViralName.NewInstance(Rank.SPECIES());
|
|
41 |
NonViralName<?> b = TaxonNameBase.NewNonViralInstance(Rank.SPECIES());
|
|
41 | 42 |
Annotation newAnnotation = Annotation.NewDefaultLanguageInstance("test"); |
42 | 43 |
b.addAnnotation(newAnnotation); |
43 | 44 |
Assert.assertEquals(newAnnotation, lastPropValue); |
cdmlib-model/src/test/java/eu/etaxonomy/cdm/aspectj/PropertyChangeTest.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2007 EDIT |
3 |
* European Distributed Institute of Taxonomy
|
|
3 |
* European Distributed Institute of Taxonomy |
|
4 | 4 |
* http://www.e-taxonomy.eu |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
9 | 9 |
|
10 | 10 |
package eu.etaxonomy.cdm.aspectj; |
11 | 11 |
|
12 |
import static org.junit.Assert.*;
|
|
12 |
import static org.junit.Assert.assertEquals;
|
|
13 | 13 |
|
14 | 14 |
import java.beans.PropertyChangeEvent; |
15 | 15 |
import java.beans.PropertyChangeListener; |
... | ... | |
22 | 22 |
import eu.etaxonomy.cdm.model.name.BotanicalName; |
23 | 23 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
24 | 24 |
import eu.etaxonomy.cdm.model.name.Rank; |
25 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
|
25 | 26 |
|
26 | 27 |
public class PropertyChangeTest implements PropertyChangeListener { |
27 | 28 |
static Logger logger = Logger.getLogger(PropertyChangeTest.class); |
28 | 29 |
private Object lastPropValue; |
29 | 30 |
|
30 |
public void propertyChange(PropertyChangeEvent e){ |
|
31 |
logger.debug("Property [" + e.getPropertyName() |
|
32 |
+ "] changed from " + e.getOldValue() |
|
31 |
@Override |
|
32 |
public void propertyChange(PropertyChangeEvent e){ |
|
33 |
logger.debug("Property [" + e.getPropertyName() |
|
34 |
+ "] changed from " + e.getOldValue() |
|
33 | 35 |
+ " to " + e.getNewValue()); |
34 | 36 |
lastPropValue = e.getNewValue() == null ? null : e.getNewValue(); |
35 | 37 |
} |
36 | 38 |
|
37 | 39 |
@Test |
38 | 40 |
public void testPropertyChange() { |
39 |
NonViralName b = NonViralName.NewInstance(Rank.SPECIES());
|
|
41 |
NonViralName<?> b = TaxonNameBase.NewNonViralInstance(Rank.SPECIES());
|
|
40 | 42 |
b.addPropertyChangeListener(this); |
41 | 43 |
b.setGenusOrUninomial("Abies"); |
42 | 44 |
assertEquals(b.getGenusOrUninomial(), lastPropValue); |
... | ... | |
57 | 59 |
b.setAnamorphic(true); |
58 | 60 |
assertEquals(b.isAnamorphic(), lastPropValue); |
59 | 61 |
} |
60 |
|
|
62 |
|
|
61 | 63 |
@Before |
62 | 64 |
public void updateDebugLevel(){ |
63 | 65 |
logger.setLevel(Level.INFO); |
cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/common/IdentifiableEntityTest.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2009 EDIT |
3 |
* European Distributed Institute of Taxonomy
|
|
3 |
* European Distributed Institute of Taxonomy |
|
4 | 4 |
* http://www.e-taxonomy.eu |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
... | ... | |
25 | 25 |
import eu.etaxonomy.cdm.model.name.HybridRelationshipType; |
26 | 26 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
27 | 27 |
import eu.etaxonomy.cdm.model.name.Rank; |
28 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
|
28 | 29 |
import eu.etaxonomy.cdm.model.reference.Reference; |
29 | 30 |
import eu.etaxonomy.cdm.model.reference.ReferenceFactory; |
30 | 31 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
... | ... | |
35 | 36 |
* @version 1.0 |
36 | 37 |
*/ |
37 | 38 |
public class IdentifiableEntityTest { |
38 |
|
|
39 |
|
|
39 | 40 |
private NonViralName<?> abies; |
40 | 41 |
private NonViralName<?> abiesMill; |
41 | 42 |
private NonViralName<?> abiesAlba; |
... | ... | |
43 | 44 |
private NonViralName<?> abiesAlbaMill; |
44 | 45 |
private NonViralName<?> abiesAlbaxPinusBeta; |
45 | 46 |
private NonViralName<?> pinusBeta; |
46 |
|
|
47 |
|
|
47 | 48 |
private Taxon abiesTaxon; |
48 | 49 |
private Taxon abiesMillTaxon; |
49 |
|
|
50 |
|
|
50 | 51 |
private NonViralName<?> abiesAutonym; |
51 | 52 |
private Taxon abiesAutonymTaxon; |
52 |
|
|
53 |
|
|
53 | 54 |
private NonViralName<?> abiesBalsamea; |
54 | 55 |
private Taxon abiesBalsameaTaxon; |
55 | 56 |
private Taxon abiesAlbaxPinusBetaTaxon; |
56 | 57 |
/** |
57 | 58 |
* @throws java.lang.Exception |
58 | 59 |
*/ |
59 |
|
|
60 |
|
|
60 | 61 |
@BeforeClass |
61 | 62 |
public static void setUpBeforeClass() { |
62 | 63 |
DefaultTermInitializer vocabularyStore = new DefaultTermInitializer(); |
63 | 64 |
vocabularyStore.initialize(); |
64 |
|
|
65 |
|
|
65 | 66 |
} |
66 | 67 |
/** |
67 | 68 |
* @throws java.lang.Exception |
... | ... | |
76 | 77 |
@Before |
77 | 78 |
public void setUp() throws Exception { |
78 | 79 |
|
79 |
abies = NonViralName.NewInstance(Rank.GENUS(), null);
|
|
80 |
abies = TaxonNameBase.NewNonViralInstance(Rank.GENUS(), null);
|
|
80 | 81 |
abies.setNameCache("Abies"); |
81 | 82 |
abies.setTitleCache("Abies", true); |
82 | 83 |
Reference sec = ReferenceFactory.newArticle(); |
83 | 84 |
sec.setTitle("Abies alba Ref"); |
84 |
|
|
85 |
|
|
85 | 86 |
abiesTaxon = Taxon.NewInstance(abies, sec); |
86 |
|
|
87 |
abiesMill = NonViralName.NewInstance(Rank.GENUS(), null);
|
|
87 |
|
|
88 |
abiesMill = TaxonNameBase.NewNonViralInstance(Rank.GENUS(), null);
|
|
88 | 89 |
abiesMill.setNameCache("Abies"); |
89 | 90 |
abiesMill.setTitleCache("Abies Mill.", true); |
90 | 91 |
abiesMillTaxon = Taxon.NewInstance(abiesMill, sec); |
91 |
|
|
92 |
abiesAlba = NonViralName.NewInstance(Rank.SPECIES(), null);
|
|
92 |
|
|
93 |
abiesAlba = TaxonNameBase.NewNonViralInstance(Rank.SPECIES(), null);
|
|
93 | 94 |
abiesAlba.setNameCache("Abies alba"); |
94 | 95 |
abiesAlba.setTitleCache("Abies alba", true); |
95 |
|
|
96 |
abiesAlbaMichx = NonViralName.NewInstance(Rank.SPECIES(), null);
|
|
96 |
|
|
97 |
abiesAlbaMichx = TaxonNameBase.NewNonViralInstance(Rank.SPECIES(), null);
|
|
97 | 98 |
abiesAlbaMichx.setNameCache("Abies alba"); |
98 | 99 |
abiesAlbaMichx.setTitleCache("Abies alba Michx.", true); |
99 |
|
|
100 |
abiesAlbaMill = NonViralName.NewInstance(Rank.SPECIES(), null);
|
|
100 |
|
|
101 |
abiesAlbaMill = TaxonNameBase.NewNonViralInstance(Rank.SPECIES(), null);
|
|
101 | 102 |
abiesAlbaMill.setNameCache("Abies alba"); |
102 | 103 |
abiesAlbaMill.setTitleCache("Abies alba Mill.", true); |
103 |
|
|
104 |
abiesAutonym = NonViralName.NewInstance(Rank.SECTION_BOTANY());
|
|
104 |
|
|
105 |
abiesAutonym = TaxonNameBase.NewNonViralInstance(Rank.SECTION_BOTANY());
|
|
105 | 106 |
abiesAutonym.setGenusOrUninomial("Abies"); |
106 | 107 |
abiesAutonym.setInfraGenericEpithet("Abies"); |
107 |
|
|
108 |
|
|
108 | 109 |
abiesAutonym.setTitleCache("Abies Mill. sect. Abies", true); |
109 | 110 |
abiesAutonym.getNameCache(); |
110 | 111 |
abiesAutonymTaxon = Taxon.NewInstance(abiesAutonym, sec); |
111 |
|
|
112 |
abiesBalsamea = NonViralName.NewInstance(Rank.SECTION_BOTANY());
|
|
112 |
|
|
113 |
abiesBalsamea = TaxonNameBase.NewNonViralInstance(Rank.SECTION_BOTANY());
|
|
113 | 114 |
abiesBalsamea.setGenusOrUninomial("Abies"); |
114 | 115 |
abiesBalsamea.setInfraGenericEpithet("Balsamea"); |
115 | 116 |
abiesBalsamea.getNameCache(); |
116 | 117 |
abiesBalsamea.setTitleCache("Abies sect. Balsamea L.", true); |
117 | 118 |
abiesBalsameaTaxon = Taxon.NewInstance(abiesBalsamea, sec); |
118 |
|
|
119 |
abiesAlbaxPinusBeta = NonViralName.NewInstance(Rank.SPECIES());
|
|
120 |
pinusBeta = NonViralName.NewInstance(Rank.SPECIES());
|
|
119 |
|
|
120 |
abiesAlbaxPinusBeta = TaxonNameBase.NewNonViralInstance(Rank.SPECIES());
|
|
121 |
pinusBeta = TaxonNameBase.NewNonViralInstance(Rank.SPECIES());
|
|
121 | 122 |
pinusBeta.setGenusOrUninomial("Pinus"); |
122 | 123 |
pinusBeta.setSpecificEpithet("beta"); |
123 | 124 |
abiesAlbaxPinusBeta.setHybridFormula(true); |
124 | 125 |
abiesAlbaxPinusBeta.addHybridParent(abiesAlba, HybridRelationshipType.FIRST_PARENT(), null); |
125 | 126 |
abiesAlbaxPinusBeta.addHybridParent(pinusBeta, HybridRelationshipType.SECOND_PARENT(), null); |
126 |
|
|
127 |
|
|
127 | 128 |
} |
128 | 129 |
|
129 | 130 |
/** |
... | ... | |
132 | 133 |
@After |
133 | 134 |
public void tearDown() throws Exception { |
134 | 135 |
} |
135 |
|
|
136 |
|
|
136 | 137 |
/** |
137 | 138 |
* Test method for {@link eu.etaxonomy.cdm.model.common.IdentifiableEntity#compareTo(eu.etaxonomy.cdm.model.common.IdentifiableEntity)}. |
138 | 139 |
*/ |
139 | 140 |
@Test |
140 | 141 |
public void testCompareTo() { |
141 | 142 |
int result = 0; |
142 |
|
|
143 |
|
|
143 | 144 |
// "Abies" < "Abies Mill." |
144 | 145 |
result = abies.compareTo(abiesMill); |
145 | 146 |
assertTrue(result < 0); |
146 |
|
|
147 |
|
|
147 | 148 |
abiesTaxon = abies.getTaxa().iterator().next(); |
148 |
|
|
149 |
|
|
149 | 150 |
assertTrue(abiesTaxon.compareTo(abiesTaxon) == 0); |
150 |
|
|
151 |
|
|
151 | 152 |
assertTrue(abiesMillTaxon.compareTo(abiesTaxon) > 0); |
152 |
|
|
153 |
|
|
153 | 154 |
assertTrue(abiesTaxon.compareTo(abiesMillTaxon) < 0); |
154 |
|
|
155 |
|
|
155 | 156 |
// "Abies Mill." > "Abies" |
156 | 157 |
result = abiesMill.compareTo(abies); |
157 | 158 |
assertTrue(result > 0); |
158 |
|
|
159 |
|
|
159 | 160 |
// "Abies" < "Abies alba" |
160 | 161 |
result = abies.compareTo(abiesAlba); |
161 | 162 |
assertTrue(result < 0); |
162 |
|
|
163 |
|
|
163 | 164 |
// "Abies alba" > "Abies" |
164 | 165 |
result = abiesAlba.compareTo(abies); |
165 | 166 |
assertTrue(result > 0); |
... | ... | |
167 | 168 |
// "Abies Mill." < "Abies alba Michx." |
168 | 169 |
result = abiesMill.compareTo(abiesAlbaMichx); |
169 | 170 |
assertTrue(result < 0); |
170 |
|
|
171 |
|
|
171 | 172 |
// "Abies alba Michx." > "Abies Mill." |
172 | 173 |
result = abiesAlbaMichx.compareTo(abiesMill); |
173 | 174 |
assertTrue(result > 0); |
174 |
|
|
175 |
|
|
175 | 176 |
//Autonym should sorted without the authorstring |
176 |
|
|
177 |
|
|
177 | 178 |
result = abiesAutonym.compareTo(abiesBalsamea); |
178 | 179 |
assertTrue(result < 0); |
179 |
// Test consistency of compareTo() with equals():
|
|
180 |
// Test consistency of compareTo() with equals(): |
|
180 | 181 |
// Is consistent if and only if for every e1 and e2 of class C |
181 |
// e1.compareTo(e2) == 0 has the same boolean value as e1.equals(e2)
|
|
182 |
|
|
182 |
// e1.compareTo(e2) == 0 has the same boolean value as e1.equals(e2) |
|
183 |
|
|
183 | 184 |
boolean compareResult = false; |
184 | 185 |
boolean equalsResult = false; |
185 |
|
|
186 |
|
|
186 | 187 |
compareResult = (abies.compareTo(abies) == 0); |
187 | 188 |
equalsResult = abies.equals(abies); |
188 | 189 |
assertEquals(compareResult, equalsResult); |
189 |
|
|
190 |
|
|
190 | 191 |
compareResult = (abies.compareTo(abiesAlba) == 0); |
191 | 192 |
equalsResult = abies.equals(abiesAlba); |
192 | 193 |
assertEquals(compareResult, equalsResult); |
193 |
|
|
194 |
|
|
194 | 195 |
compareResult = (abiesMill.compareTo(abies) == 0); |
195 | 196 |
equalsResult = abiesMill.equals(abies); |
196 | 197 |
assertEquals(compareResult, equalsResult); |
197 |
|
|
198 |
|
|
198 | 199 |
//Abies alba x Pinus beta < Abies alba xinus |
199 | 200 |
BotanicalName abiesAlbaXinus = BotanicalName.NewInstance(Rank.SUBSPECIES()); |
200 | 201 |
abiesAlbaXinus.setGenusOrUninomial("Abies"); |
... | ... | |
203 | 204 |
result = abiesAlbaxPinusBeta.compareTo(abiesAlbaXinus); |
204 | 205 |
assertTrue(result < 0); |
205 | 206 |
} |
206 |
|
|
207 |
|
|
207 | 208 |
/** |
208 | 209 |
* Test method for {@link eu.etaxonomy.cdm.model.common.IdentifiableEntity#addCredit(eu.etaxonomy.cdm.model.common.IdentifiableEntity)}. |
209 | 210 |
*/ |
... | ... | |
223 | 224 |
assertEquals("Number of credits should be 3",3,abies.getCredits().size()); |
224 | 225 |
assertEquals("Credit0 should be last in list", text3, abies.getCredits(2).getText()); |
225 | 226 |
} |
226 |
|
|
227 |
|
|
227 | 228 |
/** |
228 | 229 |
* Test method for {@link eu.etaxonomy.cdm.model.common.IdentifiableEntity#addCredit(eu.etaxonomy.cdm.model.common.IdentifiableEntity)}. |
229 | 230 |
*/ |
... | ... | |
247 | 248 |
assertNotNull("A list should always be returned",abies.getCredits()); |
248 | 249 |
assertTrue("No credits should exist",abies.getCredits().isEmpty()); |
249 | 250 |
} |
250 |
|
|
251 |
|
|
251 | 252 |
@Test |
252 | 253 |
public void testClone(){ |
253 | 254 |
IdentifiableEntity clone = (IdentifiableEntity)abies.clone(); |
cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/name/NonViralNameTest.java | ||
---|---|---|
98 | 98 |
*/ |
99 | 99 |
@Test |
100 | 100 |
public final void testNonViralNameRank() { |
101 |
NonViralName<?> nonViralName = NonViralName.NewInstance(Rank.GENUS());
|
|
101 |
NonViralName<?> nonViralName = TaxonNameBase.NewNonViralInstance(Rank.GENUS());
|
|
102 | 102 |
assertNotNull(nonViralName); |
103 | 103 |
} |
104 | 104 |
|
... | ... | |
325 | 325 |
assertEquals(0, botanicalName1.getHybridParentRelations().size()); |
326 | 326 |
assertEquals(0, botanicalName1.getHybridChildRelations().size()); |
327 | 327 |
BotanicalName femaleParent = BotanicalName.NewInstance(null); |
328 |
NonViralName<?> maleParent = NonViralName.NewInstance(null);
|
|
328 |
NonViralName<?> maleParent = TaxonNameBase.NewNonViralInstance(null);
|
|
329 | 329 |
ZoologicalName child = TaxonNameBase.NewZoologicalInstance(null); |
330 | 330 |
|
331 | 331 |
botanicalName1.addHybridParent(femaleParent, HybridRelationshipType.FEMALE_PARENT(), null); |
... | ... | |
365 | 365 |
nonViralName1.setInfraSpecificEpithet("infrabus"); |
366 | 366 |
nonViralName1.setBinomHybrid(true); |
367 | 367 |
|
368 |
NonViralName<?> parent = NonViralName.NewInstance(Rank.SPECIES());
|
|
369 |
NonViralName<?> parent2 = NonViralName.NewInstance(Rank.SPECIES());
|
|
370 |
NonViralName<?> child = NonViralName.NewInstance(Rank.SPECIES());
|
|
371 |
NonViralName<?> child2 = NonViralName.NewInstance(Rank.SPECIES());
|
|
368 |
NonViralName<?> parent = TaxonNameBase.NewNonViralInstance(Rank.SPECIES());
|
|
369 |
NonViralName<?> parent2 = TaxonNameBase.NewNonViralInstance(Rank.SPECIES());
|
|
370 |
NonViralName<?> child = TaxonNameBase.NewNonViralInstance(Rank.SPECIES());
|
|
371 |
NonViralName<?> child2 = TaxonNameBase.NewNonViralInstance(Rank.SPECIES());
|
|
372 | 372 |
nonViralName1.addHybridParent(parent, HybridRelationshipType.FIRST_PARENT(), "parent rule"); |
373 | 373 |
nonViralName1.addHybridParent(parent2, HybridRelationshipType.SECOND_PARENT(), "parent rule2"); |
374 | 374 |
nonViralName1.addHybridChild(child, HybridRelationshipType.FEMALE_PARENT(), "child rule"); |
cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/name/TaxonNameBaseTest.java | ||
---|---|---|
801 | 801 |
|
802 | 802 |
@Test |
803 | 803 |
public void testClone(){ |
804 |
NonViralName taxonNameBase1 = NonViralName.NewInstance(Rank.SPECIES());
|
|
805 |
NonViralName<?> genusName = NonViralName.NewInstance(Rank.GENUS());
|
|
804 |
NonViralName taxonNameBase1 = TaxonNameBase.NewNonViralInstance(Rank.SPECIES());
|
|
805 |
NonViralName<?> genusName = TaxonNameBase.NewNonViralInstance(Rank.GENUS());
|
|
806 | 806 |
Taxon taxonBase = Taxon.NewInstance(taxonNameBase1, null); |
807 | 807 |
|
808 | 808 |
//basionym & homonym |
809 |
NonViralName<?> basionym = NonViralName.NewInstance(Rank.SPECIES());
|
|
810 |
NonViralName<?> earlierHomonym = NonViralName.NewInstance(Rank.SPECIES());
|
|
809 |
NonViralName<?> basionym = TaxonNameBase.NewNonViralInstance(Rank.SPECIES());
|
|
810 |
NonViralName<?> earlierHomonym = TaxonNameBase.NewNonViralInstance(Rank.SPECIES());
|
|
811 | 811 |
taxonNameBase1.addBasionym(basionym); |
812 | 812 |
taxonNameBase1.addRelationshipToName(earlierHomonym, NameRelationshipType.LATER_HOMONYM(), "later homonym rule"); |
813 | 813 |
//status |
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/cache/name/NonViralNameDefaultCacheStrategyTest.java | ||
---|---|---|
284 | 284 |
Assert.assertEquals(author.getNomenclaturalTitle(), speciesName.getAuthorshipCache()); |
285 | 285 |
Assert.assertEquals("Should be 'Abies alba L.'", "Abies alba L.", speciesName.getTitleCache()); |
286 | 286 |
|
287 |
NonViralName hybridName = NonViralName.NewInstance(Rank.SPECIES());
|
|
288 |
NonViralName secondParent = NonViralName.NewInstance(Rank.SPECIES());
|
|
287 |
NonViralName<?> hybridName = TaxonNameBase.NewNonViralInstance(Rank.SPECIES());
|
|
288 |
NonViralName<?> secondParent = TaxonNameBase.NewNonViralInstance(Rank.SPECIES());
|
|
289 | 289 |
|
290 | 290 |
secondParent.setTitleCache("Second parent Mill.", true); |
291 | 291 |
hybridName.addHybridParent(speciesName, HybridRelationshipType.FIRST_PARENT(), null); |
... | ... | |
518 | 518 |
@Test |
519 | 519 |
public void testGetInfraGenericNames(){ |
520 | 520 |
String author = "Anyauthor"; |
521 |
NonViralName nonViralName = NonViralName.NewInstance(Rank.SUBGENUS());
|
|
521 |
NonViralName<?> nonViralName = TaxonNameBase.NewNonViralInstance(Rank.SUBGENUS());
|
|
522 | 522 |
nonViralName.setGenusOrUninomial("Genus"); |
523 | 523 |
nonViralName.setInfraGenericEpithet("subgenus"); |
524 | 524 |
nonViralName.setAuthorshipCache(author); |
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/generate/IdentificationKeyGeneratorTest.java | ||
---|---|---|
19 | 19 |
import eu.etaxonomy.cdm.model.description.StatisticalMeasure; |
20 | 20 |
import eu.etaxonomy.cdm.model.description.StatisticalMeasurementValue; |
21 | 21 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
22 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
|
22 |
import eu.etaxonomy.cdm.model.name.INonViralName; |
|
23 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
|
23 | 24 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
24 | 25 |
|
25 | 26 |
/** |
26 | 27 |
* @author m.venin |
27 | 28 |
* @created 16.12.2010 |
28 |
* @version 1.0 |
|
29 | 29 |
*/ |
30 | 30 |
|
31 | 31 |
public class IdentificationKeyGeneratorTest { |
32 |
private static final Logger logger = Logger.getLogger(IdentificationKeyGeneratorTest.class); |
|
33 |
|
|
32 |
@SuppressWarnings("unused") |
|
33 |
private static final Logger logger = Logger.getLogger(IdentificationKeyGeneratorTest.class); |
|
34 |
|
|
34 | 35 |
private Feature feature1; |
35 | 36 |
private Feature feature2; |
36 | 37 |
private Feature feature3; |
37 | 38 |
private Feature feature4; |
38 |
|
|
39 |
|
|
39 | 40 |
private Taxon taxon1; |
40 | 41 |
private Taxon taxon2; |
41 | 42 |
private Taxon taxon3; |
... | ... | |
44 | 45 |
private Taxon taxon6; |
45 | 46 |
private Taxon taxon7; |
46 | 47 |
private Taxon taxon8; |
47 |
|
|
48 |
|
|
48 | 49 |
private TaxonDescription taxond1; |
49 | 50 |
private TaxonDescription taxond2; |
50 | 51 |
private TaxonDescription taxond3; |
... | ... | |
53 | 54 |
private TaxonDescription taxond6; |
54 | 55 |
private TaxonDescription taxond7; |
55 | 56 |
private TaxonDescription taxond8; |
56 |
|
|
57 |
|
|
57 | 58 |
private Set<TaxonDescription> taxa; |
58 | 59 |
private List<Feature> features; |
59 |
|
|
60 |
|
|
60 | 61 |
private PolytomousKeyGenerator generator; |
61 |
|
|
62 |
|
|
62 | 63 |
@Before |
63 | 64 |
public void setUp() throws Exception { |
64 | 65 |
feature1 = Feature.NewInstance("","Shape of the head",""); |
65 | 66 |
feature2 = Feature.NewInstance("","Presence of wings",""); |
66 | 67 |
feature3 = Feature.NewInstance("","Length of wings",""); |
67 | 68 |
feature4 = Feature.NewInstance("","Colour",""); |
68 |
|
|
69 |
NonViralName tn1 = NonViralName.NewInstance(null);
|
|
70 |
NonViralName tn2 = NonViralName.NewInstance(null);
|
|
71 |
NonViralName tn3 = NonViralName.NewInstance(null);
|
|
72 |
NonViralName tn4 = NonViralName.NewInstance(null);
|
|
73 |
NonViralName tn5 = NonViralName.NewInstance(null);
|
|
74 |
NonViralName tn6 = NonViralName.NewInstance(null);
|
|
75 |
NonViralName tn7 = NonViralName.NewInstance(null);
|
|
76 |
NonViralName tn8 = NonViralName.NewInstance(null);
|
|
77 |
|
|
69 |
|
|
70 |
INonViralName tn1 = TaxonNameBase.NewNonViralInstance(null);
|
|
71 |
INonViralName tn2 = TaxonNameBase.NewNonViralInstance(null);
|
|
72 |
INonViralName tn3 = TaxonNameBase.NewNonViralInstance(null);
|
|
73 |
INonViralName tn4 = TaxonNameBase.NewNonViralInstance(null);
|
|
74 |
INonViralName tn5 = TaxonNameBase.NewNonViralInstance(null);
|
|
75 |
INonViralName tn6 = TaxonNameBase.NewNonViralInstance(null);
|
|
76 |
INonViralName tn7 = TaxonNameBase.NewNonViralInstance(null);
|
|
77 |
INonViralName tn8 = TaxonNameBase.NewNonViralInstance(null);
|
|
78 |
|
|
78 | 79 |
taxon1 = Taxon.NewInstance(tn1, null); |
79 | 80 |
taxon2 = Taxon.NewInstance(tn2, null); |
80 | 81 |
taxon3 = Taxon.NewInstance(tn3, null); |
... | ... | |
83 | 84 |
taxon6 = Taxon.NewInstance(tn6, null); |
84 | 85 |
taxon7 = Taxon.NewInstance(tn7, null); |
85 | 86 |
taxon8 = Taxon.NewInstance(tn8, null); |
86 |
|
|
87 |
|
|
87 | 88 |
taxond1 = TaxonDescription.NewInstance(taxon1); |
88 | 89 |
taxond2 = TaxonDescription.NewInstance(taxon2); |
89 | 90 |
taxond3 = TaxonDescription.NewInstance(taxon3); |
... | ... | |
92 | 93 |
taxond6 = TaxonDescription.NewInstance(taxon6); |
93 | 94 |
taxond7 = TaxonDescription.NewInstance(taxon7); |
94 | 95 |
taxond8 = TaxonDescription.NewInstance(taxon8); |
95 |
|
|
96 |
|
|
96 | 97 |
CategoricalData catd11 = CategoricalData.NewInstance(); |
97 | 98 |
catd11.setFeature(feature1); |
98 | 99 |
StateData sd11 = StateData.NewInstance(); |
... | ... | |
100 | 101 |
State s12 = State.NewInstance("","Circular",""); |
101 | 102 |
sd11.setState(s11); |
102 | 103 |
catd11.addStateData(sd11); |
103 |
|
|
104 |
|
|
104 | 105 |
CategoricalData catd12 = CategoricalData.NewInstance(); |
105 | 106 |
catd12.setFeature(feature1); |
106 | 107 |
StateData sd12 = StateData.NewInstance(); |
107 | 108 |
sd12.setState(s11); |
108 | 109 |
catd12.addStateData(sd12); |
109 |
|
|
110 |
|
|
110 | 111 |
CategoricalData catd13 = CategoricalData.NewInstance(); |
111 | 112 |
catd13.setFeature(feature1); |
112 | 113 |
StateData sd13 = StateData.NewInstance(); |
113 | 114 |
sd13.setState(s11); |
114 | 115 |
catd13.addStateData(sd13); |
115 |
|
|
116 |
|
|
116 | 117 |
CategoricalData catd14 = CategoricalData.NewInstance(); |
117 | 118 |
catd14.setFeature(feature1); |
118 | 119 |
StateData sd14 = StateData.NewInstance(); |
119 | 120 |
sd14.setState(s11); |
120 | 121 |
catd14.addStateData(sd14); |
121 |
|
|
122 |
|
|
122 | 123 |
CategoricalData catd15 = CategoricalData.NewInstance(); |
123 | 124 |
catd15.setFeature(feature1); |
124 | 125 |
StateData sd15 = StateData.NewInstance(); |
125 | 126 |
sd15.setState(s12); |
126 | 127 |
catd15.addStateData(sd15); |
127 |
|
|
128 |
|
|
128 | 129 |
CategoricalData catd16 = CategoricalData.NewInstance(); |
129 | 130 |
catd16.setFeature(feature1); |
130 | 131 |
StateData sd16 = StateData.NewInstance(); |
131 | 132 |
sd16.setState(s12); |
132 | 133 |
catd16.addStateData(sd16); |
133 |
|
|
134 |
|
|
134 | 135 |
CategoricalData catd17 = CategoricalData.NewInstance(); |
135 | 136 |
catd17.setFeature(feature1); |
136 | 137 |
StateData sd17 = StateData.NewInstance(); |
137 | 138 |
sd17.setState(s12); |
138 | 139 |
catd17.addStateData(sd17); |
139 |
|
|
140 |
|
|
140 | 141 |
CategoricalData catd18 = CategoricalData.NewInstance(); |
141 | 142 |
catd18.setFeature(feature1); |
142 | 143 |
StateData sd18 = StateData.NewInstance(); |
143 | 144 |
sd18.setState(s12); |
144 | 145 |
catd18.addStateData(sd18); |
145 |
|
|
146 |
|
|
146 | 147 |
/*************************/ |
147 |
|
|
148 |
|
|
148 | 149 |
CategoricalData catd21 = CategoricalData.NewInstance(); |
149 | 150 |
catd21.setFeature(feature2); |
150 | 151 |
StateData sd21 = StateData.NewInstance(); |
... | ... | |
152 | 153 |
State s22 = State.NewInstance("","No",""); |
153 | 154 |
sd21.setState(s21); |
154 | 155 |
catd21.addStateData(sd21); |
155 |
|
|
156 |
|
|
156 | 157 |
CategoricalData catd22 = CategoricalData.NewInstance(); |
157 | 158 |
catd22.setFeature(feature2); |
158 | 159 |
StateData sd22 = StateData.NewInstance(); |
159 | 160 |
sd22.setState(s21); |
160 | 161 |
catd22.addStateData(sd22); |
161 |
|
|
162 |
|
|
162 | 163 |
CategoricalData catd23 = CategoricalData.NewInstance(); |
163 | 164 |
catd23.setFeature(feature2); |
164 | 165 |
StateData sd23 = StateData.NewInstance(); |
165 | 166 |
sd23.setState(s21); |
166 | 167 |
catd23.addStateData(sd23); |
167 |
|
|
168 |
|
|
168 | 169 |
CategoricalData catd24 = CategoricalData.NewInstance(); |
169 | 170 |
catd24.setFeature(feature2); |
170 | 171 |
StateData sd24 = StateData.NewInstance(); |
171 | 172 |
sd24.setState(s21); |
172 | 173 |
catd24.addStateData(sd24); |
173 |
|
|
174 |
|
|
174 | 175 |
CategoricalData catd25 = CategoricalData.NewInstance(); |
175 | 176 |
catd25.setFeature(feature2); |
176 | 177 |
StateData sd25 = StateData.NewInstance(); |
177 | 178 |
sd25.setState(s21); |
178 | 179 |
catd25.addStateData(sd25); |
179 |
|
|
180 |
|
|
180 | 181 |
CategoricalData catd26 = CategoricalData.NewInstance(); |
181 | 182 |
catd26.setFeature(feature2); |
182 | 183 |
StateData sd26 = StateData.NewInstance(); |
183 | 184 |
sd26.setState(s21); |
184 | 185 |
catd26.addStateData(sd26); |
185 |
|
|
186 |
|
|
186 | 187 |
CategoricalData catd27 = CategoricalData.NewInstance(); |
187 | 188 |
catd27.setFeature(feature2); |
188 | 189 |
StateData sd27 = StateData.NewInstance(); |
189 | 190 |
sd27.setState(s21); |
190 | 191 |
catd27.addStateData(sd27); |
191 |
|
|
192 |
|
|
192 | 193 |
CategoricalData catd28 = CategoricalData.NewInstance(); |
193 | 194 |
catd28.setFeature(feature2); |
194 | 195 |
StateData sd28 = StateData.NewInstance(); |
195 | 196 |
sd28.setState(s22); |
196 | 197 |
catd28.addStateData(sd28); |
197 |
|
|
198 |
|
|
198 | 199 |
/*************************/ |
199 |
|
|
200 |
|
|
200 | 201 |
QuantitativeData qtd31 = QuantitativeData.NewInstance(); |
201 | 202 |
StatisticalMeasurementValue smv311 = StatisticalMeasurementValue.NewInstance(); |
202 | 203 |
smv311.setValue(0); |
... | ... | |
208 | 209 |
smv312.setType(sm312); |
209 | 210 |
qtd31.addStatisticalValue(smv311); |
210 | 211 |
qtd31.addStatisticalValue(smv312); |
211 |
|
|
212 |
|
|
212 | 213 |
QuantitativeData qtd32 = QuantitativeData.NewInstance(); |
213 | 214 |
StatisticalMeasurementValue smv321 = StatisticalMeasurementValue.NewInstance(); |
214 | 215 |
smv321.setValue(0); |
... | ... | |
220 | 221 |
smv322.setType(sm322); |
221 | 222 |
qtd32.addStatisticalValue(smv321); |
222 | 223 |
qtd32.addStatisticalValue(smv322); |
223 |
|
|
224 |
|
|
224 | 225 |
QuantitativeData qtd33 = QuantitativeData.NewInstance(); |
225 | 226 |
StatisticalMeasurementValue smv331 = StatisticalMeasurementValue.NewInstance(); |
226 | 227 |
smv331.setValue(6); |
... | ... | |
232 | 233 |
smv332.setType(sm332); |
233 | 234 |
qtd33.addStatisticalValue(smv331); |
234 | 235 |
qtd33.addStatisticalValue(smv332); |
235 |
|
|
236 |
|
|
236 | 237 |
QuantitativeData qtd34 = QuantitativeData.NewInstance(); |
237 | 238 |
StatisticalMeasurementValue smv341 = StatisticalMeasurementValue.NewInstance(); |
238 | 239 |
smv341.setValue(6); |
... | ... | |
244 | 245 |
smv342.setType(sm342); |
245 | 246 |
qtd34.addStatisticalValue(smv341); |
246 | 247 |
qtd34.addStatisticalValue(smv342); |
247 |
|
|
248 |
|
|
248 | 249 |
QuantitativeData qtd35 = QuantitativeData.NewInstance(); |
249 | 250 |
StatisticalMeasurementValue smv351 = StatisticalMeasurementValue.NewInstance(); |
250 | 251 |
smv351.setValue(0); |
... | ... | |
256 | 257 |
smv352.setType(sm352); |
257 | 258 |
qtd35.addStatisticalValue(smv351); |
258 | 259 |
qtd35.addStatisticalValue(smv352); |
259 |
|
|
260 |
|
|
260 | 261 |
QuantitativeData qtd36 = QuantitativeData.NewInstance(); |
261 | 262 |
StatisticalMeasurementValue smv361 = StatisticalMeasurementValue.NewInstance(); |
262 | 263 |
smv361.setValue(0); |
... | ... | |
268 | 269 |
smv362.setType(sm362); |
269 | 270 |
qtd36.addStatisticalValue(smv361); |
270 | 271 |
qtd36.addStatisticalValue(smv362); |
271 |
|
|
272 |
|
|
272 | 273 |
QuantitativeData qtd37 = QuantitativeData.NewInstance(); |
273 | 274 |
StatisticalMeasurementValue smv371 = StatisticalMeasurementValue.NewInstance(); |
274 | 275 |
smv371.setValue(6); |
... | ... | |
280 | 281 |
smv372.setType(sm372); |
281 | 282 |
qtd37.addStatisticalValue(smv371); |
282 | 283 |
qtd37.addStatisticalValue(smv372); |
283 |
|
|
284 |
|
|
284 | 285 |
// QuantitativeData qtd38 = QuantitativeData.NewInstance(); |
285 | 286 |
// StatisticalMeasurementValue smv381 = StatisticalMeasurementValue.NewInstance(); |
286 | 287 |
// smv381.setValue(6); |
... | ... | |
292 | 293 |
// smv382.setType(sm382); |
293 | 294 |
// qtd38.addStatisticalValue(smv381); |
294 | 295 |
// qtd38.addStatisticalValue(smv382); |
295 |
|
|
296 |
|
|
296 | 297 |
/*************************/ |
297 |
|
|
298 |
|
|
298 | 299 |
CategoricalData catd41 = CategoricalData.NewInstance(); |
299 | 300 |
catd41.setFeature(feature4); |
300 | 301 |
StateData sd41 = StateData.NewInstance(); |
... | ... | |
302 | 303 |
State s42 = State.NewInstance("","Yellow",""); |
303 | 304 |
sd41.setState(s41); |
304 | 305 |
catd41.addStateData(sd41); |
305 |
|
|
306 |
|
|
306 | 307 |
CategoricalData catd42 = CategoricalData.NewInstance(); |
307 | 308 |
catd42.setFeature(feature4); |
308 | 309 |
StateData sd42 = StateData.NewInstance(); |
309 | 310 |
sd42.setState(s42); |
310 | 311 |
catd42.addStateData(sd42); |
311 |
|
|
312 |
|
|
312 | 313 |
CategoricalData catd43 = CategoricalData.NewInstance(); |
313 | 314 |
catd43.setFeature(feature4); |
314 | 315 |
StateData sd43 = StateData.NewInstance(); |
315 | 316 |
sd43.setState(s41); |
316 | 317 |
catd43.addStateData(sd43); |
317 |
|
|
318 |
|
|
318 | 319 |
CategoricalData catd44 = CategoricalData.NewInstance(); |
319 | 320 |
catd44.setFeature(feature4); |
320 | 321 |
StateData sd44 = StateData.NewInstance(); |
321 | 322 |
sd44.setState(s42); |
322 | 323 |
catd44.addStateData(sd44); |
323 |
|
|
324 |
|
|
324 | 325 |
CategoricalData catd45 = CategoricalData.NewInstance(); |
325 | 326 |
catd45.setFeature(feature4); |
326 | 327 |
StateData sd45 = StateData.NewInstance(); |
327 | 328 |
sd45.setState(s41); |
328 | 329 |
catd45.addStateData(sd45); |
329 |
|
|
330 |
|
|
330 | 331 |
CategoricalData catd46 = CategoricalData.NewInstance(); |
331 | 332 |
catd46.setFeature(feature4); |
332 | 333 |
StateData sd46 = StateData.NewInstance(); |
333 | 334 |
sd46.setState(s41); |
334 | 335 |
catd46.addStateData(sd46); |
335 |
|
|
336 |
|
|
336 | 337 |
CategoricalData catd47 = CategoricalData.NewInstance(); |
337 | 338 |
catd47.setFeature(feature4); |
338 | 339 |
StateData sd47 = StateData.NewInstance(); |
339 | 340 |
sd47.setState(s41); |
340 | 341 |
catd47.addStateData(sd47); |
341 |
|
|
342 |
|
|
342 | 343 |
CategoricalData catd48 = CategoricalData.NewInstance(); |
343 | 344 |
catd48.setFeature(feature4); |
344 | 345 |
StateData sd48 = StateData.NewInstance(); |
345 | 346 |
sd48.setState(s41); |
346 | 347 |
catd48.addStateData(sd48); |
347 |
|
|
348 |
|
|
348 | 349 |
/*************************/ |
349 |
|
|
350 |
|
|
350 | 351 |
taxond1.addElement(catd11); |
351 | 352 |
taxond1.addElement(catd21); |
352 | 353 |
taxond1.addElement(qtd31); |
353 | 354 |
taxond1.addElement(catd41); |
354 |
|
|
355 |
|
|
355 | 356 |
taxond2.addElement(catd12); |
356 | 357 |
taxond2.addElement(catd22); |
357 | 358 |
taxond2.addElement(qtd32); |
358 | 359 |
taxond2.addElement(catd42); |
359 |
|
|
360 |
|
|
360 | 361 |
taxond3.addElement(catd13); |
361 | 362 |
taxond3.addElement(catd23); |
362 | 363 |
taxond3.addElement(qtd33); |
363 | 364 |
taxond3.addElement(catd43); |
364 |
|
|
365 |
|
|
365 | 366 |
taxond4.addElement(catd14); |
366 | 367 |
taxond4.addElement(catd24); |
367 | 368 |
taxond4.addElement(qtd34); |
368 | 369 |
taxond4.addElement(catd44); |
369 |
|
|
370 |
|
|
370 | 371 |
taxond5.addElement(catd15); |
371 | 372 |
taxond5.addElement(catd25); |
372 | 373 |
taxond5.addElement(qtd35); |
373 | 374 |
taxond5.addElement(catd45); |
374 |
|
|
375 |
|
|
375 | 376 |
taxond6.addElement(catd16); |
376 | 377 |
taxond6.addElement(catd26); |
377 | 378 |
taxond6.addElement(qtd36); |
378 | 379 |
taxond6.addElement(catd46); |
379 |
|
|
380 |
|
|
380 | 381 |
taxond7.addElement(catd17); |
381 | 382 |
taxond7.addElement(catd27); |
382 | 383 |
taxond7.addElement(qtd37); |
383 | 384 |
taxond7.addElement(catd47); |
384 |
|
|
385 |
|
|
385 | 386 |
taxond8.addElement(catd18); |
386 | 387 |
taxond8.addElement(catd28); |
387 | 388 |
// taxond8.addElement(qtd38); // This taxon has no wings |
388 | 389 |
taxond8.addElement(catd48); |
389 |
|
|
390 |
|
|
390 | 391 |
/*************************/ |
391 |
|
|
392 |
|
|
392 | 393 |
features = new ArrayList<Feature>(); |
393 | 394 |
features.add(feature1); |
394 | 395 |
features.add(feature2); |
395 | 396 |
features.add(feature3); |
396 | 397 |
features.add(feature4); |
397 |
|
|
398 |
|
|
398 | 399 |
taxa = new HashSet<TaxonDescription>(); |
399 | 400 |
taxa.add(taxond1); |
400 | 401 |
taxa.add(taxond2); |
... | ... | |
404 | 405 |
taxa.add(taxond6); |
405 | 406 |
taxa.add(taxond7); |
406 | 407 |
taxa.add(taxond8); |
407 |
|
|
408 |
|
|
408 | 409 |
} |
409 |
|
|
410 |
|
|
410 | 411 |
//*************************** TESTS *********************** / |
411 |
|
|
412 |
|
|
412 | 413 |
|
413 | 414 |
@Test |
414 | 415 |
public void testInvoke() { |
... | ... | |
427 | 428 |
// generator.invoke(); |
428 | 429 |
// assertNotNull("Key should exist (merge mode ON).",generator.invoke());; |
429 | 430 |
} |
430 |
|
|
431 |
|
|
431 | 432 |
@Test |
432 | 433 |
public void testInvokeWithDependencies() { |
433 | 434 |
// generator = new IdentificationKeyGenerator(); |
... | ... | |
437 | 438 |
// generator.invoke(); |
438 | 439 |
// assertNotNull("Key should exist (dependencies are present).",generator.invoke());; |
439 | 440 |
} |
440 |
|
|
441 |
|
|
441 | 442 |
} |
cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/cache/CdmCacherTest.java | ||
---|---|---|
13 | 13 |
import eu.etaxonomy.cdm.model.common.Language; |
14 | 14 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
15 | 15 |
import eu.etaxonomy.cdm.model.name.Rank; |
16 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
|
16 | 17 |
import eu.etaxonomy.cdm.model.reference.Reference; |
17 | 18 |
import eu.etaxonomy.cdm.model.reference.ReferenceFactory; |
18 | 19 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
... | ... | |
46 | 47 |
// to a taxon name with no name cache to begin with |
47 | 48 |
Reference sec = ReferenceFactory.newDatabase(); |
48 | 49 |
referenceService.save(sec); |
49 |
Taxon taxon = Taxon.NewInstance(NonViralName.NewInstance(Rank.SERIES()), sec);
|
|
50 |
Taxon taxon = Taxon.NewInstance(TaxonNameBase.NewNonViralInstance(Rank.SERIES()), sec);
|
|
50 | 51 |
taxon.setTitleCache("Tax" + "CdmCacher", true); |
51 | 52 |
taxonService.save(taxon); |
52 | 53 |
NonViralName<?> nvn = (NonViralName<?>)taxon.getName(); |
cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/NaturalLanguageGeneratorTest.java | ||
---|---|---|
18 | 18 |
import eu.etaxonomy.cdm.model.common.Language; |
19 | 19 |
import eu.etaxonomy.cdm.model.description.CategoricalData; |
20 | 20 |
import eu.etaxonomy.cdm.model.description.Feature; |
21 |
import eu.etaxonomy.cdm.model.description.FeatureTree; |
|
22 | 21 |
import eu.etaxonomy.cdm.model.description.FeatureNode; |
22 |
import eu.etaxonomy.cdm.model.description.FeatureTree; |
|
23 | 23 |
import eu.etaxonomy.cdm.model.description.MeasurementUnit; |
24 | 24 |
import eu.etaxonomy.cdm.model.description.QuantitativeData; |
25 | 25 |
import eu.etaxonomy.cdm.model.description.State; |
... | ... | |
28 | 28 |
import eu.etaxonomy.cdm.model.description.StatisticalMeasurementValue; |
29 | 29 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
30 | 30 |
import eu.etaxonomy.cdm.model.description.TextData; |
31 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
|
31 |
import eu.etaxonomy.cdm.model.name.INonViralName; |
|
32 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
|
32 | 33 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
33 | 34 |
import eu.etaxonomy.cdm.test.integration.CdmIntegrationTest; |
34 | 35 |
|
35 | 36 |
@Ignore //FIXME Remove @Ignore once maximes code is completely comitted |
36 | 37 |
public class NaturalLanguageGeneratorTest extends CdmIntegrationTest { |
37 |
|
|
38 |
|
|
38 | 39 |
@SuppressWarnings("unused") |
39 | 40 |
private static final Logger logger = Logger.getLogger(NaturalLanguageGeneratorTest.class); |
40 |
|
|
41 |
|
|
41 | 42 |
@SpringBeanByType |
42 | 43 |
private INaturalLanguageGenerator generator; |
43 |
|
|
44 |
|
|
44 | 45 |
private FeatureTree featureTree; |
45 | 46 |
private TaxonDescription description; |
46 | 47 |
Set<Feature> featureSet = new HashSet<Feature>(); |
... | ... | |
48 | 49 |
@Before |
49 | 50 |
public void setUp() throws Exception { |
50 | 51 |
// set up your test objects here |
51 |
|
|
52 |
NonViralName tnb = NonViralName.NewInstance(null);
|
|
52 |
|
|
53 |
INonViralName tnb = TaxonNameBase.NewNonViralInstance(null);
|
|
53 | 54 |
Taxon taxon = Taxon.NewInstance(tnb, null); |
54 | 55 |
description = TaxonDescription.NewInstance(taxon); |
55 |
|
|
56 |
|
|
56 | 57 |
featureTree= FeatureTree.NewInstance(); |
57 | 58 |
FeatureNode root = FeatureNode.NewInstance(); |
58 | 59 |
featureTree.setRoot(root); |
... | ... | |
81 | 82 |
FeatureNode qNode = FeatureNode.NewInstance(qFeature); |
82 | 83 |
root.addChild(qNode); |
83 | 84 |
} |
84 |
|
|
85 |
|
|
85 | 86 |
@Test |
86 | 87 |
public void testGenerateNaturalLanguageDescription() { |
87 | 88 |
assertNotNull("FeatureTree should exist", featureTree); |
... | ... | |
95 | 96 |
assertTrue("Empty text",!stringBuilder.equals("")); |
96 | 97 |
System.out.println(stringBuilder.toString()); |
97 | 98 |
} |
98 |
|
|
99 |
|
|
99 | 100 |
public void buildBranches(FeatureNode parent, String[][][] children, int level, int depth, int nodeNumber) { |
100 | 101 |
int i = nodeNumber; |
101 | 102 |
int j; |
... | ... | |
108 | 109 |
buildBranches(child, children,level+1,depth, j); |
109 | 110 |
} |
110 | 111 |
} |
111 |
|
|
112 |
|
|
112 | 113 |
} |
113 | 114 |
|
114 | 115 |
/* (non-Javadoc) |
... | ... | |
117 | 118 |
@Override |
118 | 119 |
public void createTestDataSet() throws FileNotFoundException { |
119 | 120 |
// TODO Auto-generated method stub |
120 |
|
|
121 |
|
|
121 | 122 |
} |
122 |
|
|
123 |
|
|
123 | 124 |
} |
cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/TaxonServiceImplBusinessTest.java | ||
---|---|---|
72 | 72 |
//service = new TaxonServiceImpl(); |
73 | 73 |
//nameService = new NameServiceImpl(); |
74 | 74 |
|
75 |
t1n = NonViralName.NewInstance(null);
|
|
75 |
t1n = TaxonNameBase.NewNonViralInstance(null);
|
|
76 | 76 |
t1 = Taxon.NewInstance(t1n, reference); |
77 | 77 |
|
78 |
t2n = NonViralName.NewInstance(null);
|
|
78 |
t2n = TaxonNameBase.NewNonViralInstance(null);
|
|
79 | 79 |
t2 = Taxon.NewInstance(t2n, reference); |
80 | 80 |
|
81 |
s1n = NonViralName.NewInstance(null);
|
|
81 |
s1n = TaxonNameBase.NewNonViralInstance(null);
|
|
82 | 82 |
s1 = Synonym.NewInstance(s1n, reference); |
83 | 83 |
|
84 |
s2n = NonViralName.NewInstance(null);
|
|
84 |
s2n = TaxonNameBase.NewNonViralInstance(null);
|
|
85 | 85 |
s2 = Synonym.NewInstance(s2n, reference); |
86 | 86 |
|
87 | 87 |
// referencing |
... | ... | |
142 | 142 |
@Test |
143 | 143 |
public final void testChangeSynonymWithMultipleSynonymsInHomotypicalGroupToAcceptedTaxon() { |
144 | 144 |
t1.addSynonym(s1, heteroTypicSynonymType); |
145 |
TaxonNameBase<?,?> otherHeteroSynonymName = NonViralName.NewInstance(null);
|
|
145 |
TaxonNameBase<?,?> otherHeteroSynonymName = TaxonNameBase.NewNonViralInstance(null);
|
|
146 | 146 |
t1.addHeterotypicSynonymName(otherHeteroSynonymName); |
147 |
TaxonNameBase<?,?> homotypicSynonymName = NonViralName.NewInstance(null);
|
|
147 |
TaxonNameBase<?,?> homotypicSynonymName = TaxonNameBase.NewNonViralInstance(null);
|
|
148 | 148 |
Synonym homotypicSynonym = Synonym.NewInstance(homotypicSynonymName, t1.getSec()); |
149 | 149 |
t1.addHomotypicSynonym(homotypicSynonym); |
150 | 150 |
|
... | ... | |
250 | 250 |
t1.addSynonym(s1, heteroTypicSynonymType); |
251 | 251 |
|
252 | 252 |
//s2 - heterotypic |
253 |
TaxonNameBase otherHeteroSynonymName = NonViralName.NewInstance(null);
|
|
253 |
TaxonNameBase otherHeteroSynonymName = TaxonNameBase.NewNonViralInstance(null);
|
|
254 | 254 |
Synonym s2 = Synonym.NewInstance(otherHeteroSynonymName, t1.getSec()); |
255 | 255 |
t1.addSynonym(s2, heteroTypicSynonymType); |
256 |
TaxonNameBase<?,?> otherHeteroSynonymNameB = NonViralName.NewInstance(null);
|
|
256 |
TaxonNameBase<?,?> otherHeteroSynonymNameB = TaxonNameBase.NewNonViralInstance(null);
|
|
257 | 257 |
otherHeteroSynonymName.addBasionym(otherHeteroSynonymNameB); |
258 | 258 |
Synonym s2b = Synonym.NewInstance(otherHeteroSynonymNameB, t1.getSec()); |
259 | 259 |
t1.addSynonym(s2b, heteroTypicSynonymType); |
260 | 260 |
|
261 | 261 |
//homotypic |
262 |
TaxonNameBase<?,?> homotypicSynonymName = NonViralName.NewInstance(null);
|
|
262 |
TaxonNameBase<?,?> homotypicSynonymName = TaxonNameBase.NewNonViralInstance(null);
|
|
263 | 263 |
Synonym homotypicSynonym = Synonym.NewInstance(homotypicSynonymName, t1.getSec()); |
264 | 264 |
t1.addHomotypicSynonym(homotypicSynonym); |
265 | 265 |
t1.getName().addBasionym(homotypicSynonymName); |
cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/TaxonServiceImplTest.java | ||
---|---|---|
288 | 288 |
Reference reference = ReferenceFactory.newGeneric(); |
289 | 289 |
String referenceDetail = "test"; |
290 | 290 |
|
291 |
NonViralName<?> t1n = NonViralName.NewInstance(null);
|
|
291 |
NonViralName<?> t1n = TaxonNameBase.NewNonViralInstance(null);
|
|
292 | 292 |
Taxon t1 = Taxon.NewInstance(t1n, reference); |
293 |
NonViralName<?> t2n = NonViralName.NewInstance(null);
|
|
293 |
NonViralName<?> t2n = TaxonNameBase.NewNonViralInstance(null);
|
|
294 | 294 |
Taxon t2 = Taxon.NewInstance(t2n, reference); |
295 |
NonViralName<?> s1n = NonViralName.NewInstance(null);
|
|
295 |
NonViralName<?> s1n = TaxonNameBase.NewNonViralInstance(null);
|
|
296 | 296 |
Synonym s1 = Synonym.NewInstance(s1n, reference); |
297 | 297 |
t1.addSynonym(s1, heteroTypicSynonymType); |
298 | 298 |
service.saveOrUpdate(t1); |
cdmlib-services/src/test/java/eu/etaxonomy/cdm/test/function/TestService.java | ||
---|---|---|
59 | 59 |
|
60 | 60 |
public void testAppController() { |
61 | 61 |
logger.info("Create name objects..."); |
62 |
NonViralName<?> nvn = NonViralName.NewInstance(Rank.SPECIES());
|
|
62 |
NonViralName<?> nvn = TaxonNameBase.NewNonViralInstance(Rank.SPECIES());
|
|
63 | 63 |
|
64 | 64 |
BotanicalName bn = BotanicalName.NewInstance(Rank.SUBSPECIES()); |
65 | 65 |
ZoologicalName zn = TaxonNameBase.NewZoologicalInstance(Rank.FAMILY()); |
... | ... | |
224 | 224 |
appCtr = CdmApplicationController.NewInstance(dbSchemaValidation); |
225 | 225 |
|
226 | 226 |
|
227 |
TaxonNameBase<?,?> name = NonViralName.NewInstance(null);
|
|
227 |
TaxonNameBase<?,?> name = TaxonNameBase.NewNonViralInstance(null);
|
|
228 | 228 |
name.setTitleCache("Abies alba", true); |
229 | 229 |
|
230 |
TaxonNameBase<?,?> name2 = NonViralName.NewInstance(null);
|
|
230 |
TaxonNameBase<?,?> name2 = TaxonNameBase.NewNonViralInstance(null);
|
|
231 | 231 |
name2.setTitleCache("Abies beta", true); |
232 | 232 |
|
233 | 233 |
//appCtr.getNameService().saveTaxonName(name); |
Also available in: Unified diff
ref #6360 replace NonViralName factory methods