Project

General

Profile

Download (3.09 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy 
5
* http://www.e-taxonomy.eu
6
* 
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.
9
*/
10

    
11
package eu.etaxonomy.cdm.api.service;
12

    
13
import java.util.UUID;
14

    
15
import org.junit.Assert;
16
import org.junit.Before;
17
import org.junit.Ignore;
18
import org.junit.Test;
19
import org.unitils.spring.annotation.SpringBeanByType;
20

    
21
import eu.etaxonomy.cdm.model.reference.Reference;
22
import eu.etaxonomy.cdm.model.taxon.Classification;
23
import eu.etaxonomy.cdm.model.taxon.Synonym;
24
import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType;
25
import eu.etaxonomy.cdm.model.taxon.Taxon;
26
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
27
import eu.etaxonomy.cdm.test.integration.CdmIntegrationTest;
28

    
29
/**
30
 * @author n.hoffmann
31
 * @created Dec 16, 2010
32
 * @version 1.0
33
 */
34
public class TaxonNodeServiceImplTest extends CdmIntegrationTest{
35

    
36
	@SpringBeanByType
37
	private ITaxonNodeService taxonNodeService;
38
	
39
	@SpringBeanByType
40
	private IClassificationService classificationService;
41
	
42
	@SpringBeanByType
43
	private IReferenceService referenceService;
44
	
45
	private static final UUID t1Uuid = UUID.fromString("55c3e41a-c629-40e6-aa6a-ff274ac6ddb1");
46
	private static final UUID t2Uuid = UUID.fromString("2659a7e0-ff35-4ee4-8493-b453756ab955");
47
	private static final UUID classificationUuid = UUID.fromString("6c2bc8d9-ee62-4222-be89-4a8e31770878");
48
	private static final UUID referenceUuid = UUID.fromString("de7d1205-291f-45d9-9059-ca83fc7ade14");
49
	private static final UUID node1Uuid = UUID.fromString("484a1a77-689c-44be-8e65-347d835f47e8");
50
	private static final UUID node2Uuid = UUID.fromString("2d41f0c2-b785-4f73-a436-cc2d5e93cc5b");
51
	
52
	private Taxon t1;
53
	private Taxon t2;
54
	private Synonym s1;
55
	private SynonymRelationshipType synonymRelationshipType;
56
	private Reference reference;
57
	private String referenceDetail;
58
	private Classification classification;
59
	private TaxonNode node2;
60
	private TaxonNode node1;
61

    
62
	/**
63
	 * @throws java.lang.Exception
64
	 */
65
	@Before
66
	public void setUp() throws Exception {
67
		
68
		classification = classificationService.load(classificationUuid);
69
		
70
		node1 = taxonNodeService.load(node1Uuid);
71
		
72
		node2 = taxonNodeService.load(node2Uuid);
73
		
74
		reference = referenceService.load(referenceUuid);
75
		
76
		// referencing
77
		synonymRelationshipType = SynonymRelationshipType.HOMOTYPIC_SYNONYM_OF();
78
		referenceDetail = "test"; 
79
	}
80
	
81
	/**
82
	 * Test method for {@link eu.etaxonomy.cdm.api.service.TaxonNodeServiceImpl#makeTaxonNodeASynonymOfAnotherTaxonNode(eu.etaxonomy.cdm.model.taxon.TaxonNode, eu.etaxonomy.cdm.model.taxon.TaxonNode, eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType, eu.etaxonomy.cdm.model.reference.Reference, java.lang.String)}.
83
	 */
84
	@Test
85
	@Ignore
86
	public final void testMakeTaxonNodeASynonymOfAnotherTaxonNode() {
87
		// descriptions
88
		
89
		taxonNodeService.makeTaxonNodeASynonymOfAnotherTaxonNode(node1, node2, synonymRelationshipType, reference, referenceDetail);
90
		
91
		Assert.assertFalse(t2.getSynonyms().isEmpty());
92
		Assert.assertTrue(t2.getDescriptions().size() == 2);
93
		
94
	}
95

    
96
}
(9-9/14)