35 |
35 |
import org.joda.time.DateTime;
|
36 |
36 |
import org.joda.time.DateTimeFieldType;
|
37 |
37 |
import org.joda.time.Partial;
|
|
38 |
import org.junit.Assert;
|
38 |
39 |
import org.junit.Before;
|
39 |
40 |
import org.junit.BeforeClass;
|
40 |
|
import org.junit.Ignore;
|
41 |
41 |
import org.junit.Test;
|
42 |
42 |
import org.unitils.UnitilsJUnit4;
|
43 |
43 |
import org.unitils.spring.annotation.SpringApplicationContext;
|
44 |
44 |
import org.unitils.spring.annotation.SpringBeanByType;
|
45 |
45 |
|
46 |
46 |
import com.github.dozermapper.core.Mapper;
|
|
47 |
import com.ibm.lsid.MalformedLSIDException;
|
47 |
48 |
|
48 |
49 |
import eu.etaxonomy.cdm.common.URI;
|
49 |
50 |
import eu.etaxonomy.cdm.model.agent.Person;
|
... | ... | |
71 |
72 |
import eu.etaxonomy.cdm.model.taxon.Taxon;
|
72 |
73 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
|
73 |
74 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
|
|
75 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
|
74 |
76 |
import eu.etaxonomy.cdm.model.term.DefaultTermInitializer;
|
75 |
77 |
import eu.etaxonomy.cdm.remote.dto.dwc.SimpleDarwinRecord;
|
76 |
78 |
import eu.etaxonomy.cdm.remote.dto.oaipmh.OaiDc;
|
|
79 |
import eu.etaxonomy.cdm.remote.dto.tdwg.voc.Relationship;
|
77 |
80 |
import eu.etaxonomy.cdm.remote.dto.tdwg.voc.SpeciesProfileModel;
|
78 |
81 |
import eu.etaxonomy.cdm.remote.dto.tdwg.voc.TaxonConcept;
|
79 |
82 |
import eu.etaxonomy.cdm.remote.view.OaiPmhViewTest;
|
... | ... | |
132 |
135 |
taxon.setTitleCache("titleCache", true);
|
133 |
136 |
taxon.setLsid(lsid);
|
134 |
137 |
|
135 |
|
for(int i = 0; i < 10; i++) {
|
|
138 |
for(int i = 2; i < 2+10; i++) {
|
136 |
139 |
Taxon child = Taxon.NewInstance(name, (Reference)sec);
|
137 |
|
child.setLsid(new LSID("urn:lsid:example.org:taxonconcepts:" + (2 + i )));
|
138 |
|
// taxon.addTaxonomicChild(child, null,null);
|
|
140 |
child.setLsid(new LSID("urn:lsid:example.org:taxonconcepts:r" + i ));
|
|
141 |
child.addTaxonRelation(taxon, TaxonRelationshipType.TAXONOMICALLY_INCLUDED_IN(), null, null);
|
139 |
142 |
}
|
140 |
143 |
|
141 |
|
|
142 |
144 |
taxonDescription = TaxonDescription.NewInstance();
|
143 |
145 |
taxon.addDescription(taxonDescription);
|
144 |
146 |
|
... | ... | |
191 |
193 |
bookSection.addSource(IdentifiableSource.NewDataImportInstance("http://persitent.IdentifiableSources.foo/2"));
|
192 |
194 |
}
|
193 |
195 |
|
194 |
|
@Ignore
|
195 |
196 |
@Test
|
196 |
197 |
public void testDeepMapping() {
|
197 |
198 |
|
... | ... | |
199 |
200 |
return;
|
200 |
201 |
}
|
201 |
202 |
|
202 |
|
for(int i = 0; i < 3; i++) {
|
|
203 |
for(int i = 1; i < 1+3; i++) {
|
203 |
204 |
Synonym synonym = Synonym.NewInstance(name,(Reference)sec);
|
|
205 |
try {
|
|
206 |
synonym.setLsid(new LSID("urn:lsid:example.org:synyonms:" + i ));
|
|
207 |
} catch (MalformedLSIDException e) {}
|
204 |
208 |
taxon.addSynonym(synonym, SynonymType.SYNONYM_OF());
|
205 |
209 |
}
|
206 |
210 |
|
... | ... | |
221 |
225 |
assertNotNull("Taxon.relationsToThisTaxon should be copied into TaxonConcept.hasRelationship",taxonConcept.getHasRelationship());
|
222 |
226 |
assertEquals("There should be 13 relations in TaxonConcept.hasRelationship",
|
223 |
227 |
13, taxonConcept.getHasRelationship().size());
|
|
228 |
int nSynonyms = 0;
|
|
229 |
int nTaxa = 0;
|
|
230 |
for (Relationship rel : taxonConcept.getHasRelationship()){
|
|
231 |
Assert.assertNotNull(rel.getFromTaxon());
|
|
232 |
System.out.println(rel.getFromTaxon().getIdentifier().toString());
|
|
233 |
if (rel.getFromTaxon().getIdentifier().toString().startsWith("urn:lsid:example.org:synyonms:")){
|
|
234 |
nSynonyms++;
|
|
235 |
}else if (rel.getFromTaxon().getIdentifier().toString().startsWith("urn:lsid:example.org:taxonconcepts:")){
|
|
236 |
nTaxa++;
|
|
237 |
}
|
|
238 |
// System.out.println(rel);
|
|
239 |
}
|
|
240 |
Assert.assertEquals(3, nSynonyms);
|
|
241 |
Assert.assertEquals(10, nTaxa);
|
224 |
242 |
}
|
225 |
243 |
|
226 |
244 |
@Test
|
... | ... | |
241 |
259 |
assertNull("TaxonBase.sec was uninitialized, so TaxonConcept.accordingTo should be null",taxonConcept.getAccordingTo());
|
242 |
260 |
}
|
243 |
261 |
|
244 |
|
@Ignore
|
245 |
262 |
@Test
|
246 |
263 |
public void testLazyInitializationExceptionWithPersistentCollection() throws Exception {
|
247 |
264 |
|
fix #6324 fix synonym dozer mapping for TDWG Ontology