Project

General

Profile

Download (3.33 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.dbunit.annotation.DataSet;
20
import org.unitils.spring.annotation.SpringBeanByType;
21

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

    
30
/**
31
 * @author n.hoffmann
32
 * @created Dec 16, 2010
33
 * @version 1.0
34
 */
35

    
36
public class TaxonNodeServiceImplTest extends CdmIntegrationTest{
37

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

    
64
	/**
65
	 * @throws java.lang.Exception
66
	 */
67
	@Before
68
	public void setUp() throws Exception {
69
	}
70
	
71
	/**
72
	 * 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)}.
73
	 */
74
	@Test
75
	@DataSet
76
	public final void testMakeTaxonNodeASynonymOfAnotherTaxonNode() {
77
		classification = classificationService.load(classificationUuid);
78
		node1 = taxonNodeService.load(node1Uuid);
79
		node2 = taxonNodeService.load(node2Uuid);
80
		reference = referenceService.load(referenceUuid);
81
		synonymRelationshipType = SynonymRelationshipType.HOMOTYPIC_SYNONYM_OF();
82
		referenceDetail = "test"; 
83

    
84
		//
85
		//TODO
86
		
87

    
88
		// descriptions
89
		t1 = node1.getTaxon();
90
		t2 = node2.getTaxon();
91
		Assert.assertEquals(2, t1.getDescriptions().size());
92
		Assert.assertTrue(t2.getSynonyms().isEmpty());
93
		Assert.assertTrue(t2.getDescriptions().size() == 0);
94
		
95
		taxonNodeService.makeTaxonNodeASynonymOfAnotherTaxonNode(node1, node2, synonymRelationshipType, reference, referenceDetail);
96
		
97
		Assert.assertFalse(t2.getSynonyms().isEmpty());
98
		Assert.assertEquals(2, t2.getDescriptions().size());
99
		
100
	}
101

    
102
}
(9-9/14)