Project

General

Profile

Download (2.28 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2009 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/ 
9

    
10
package eu.etaxonomy.cdm.api.service.lsid;
11

    
12
import static org.junit.Assert.assertEquals;
13
import static org.junit.Assert.assertNotNull;
14

    
15
import java.util.List;
16

    
17
import org.junit.Before;
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.api.service.INameService;
23
import eu.etaxonomy.cdm.api.service.lsid.impl.LsidRegistryImpl;
24
import eu.etaxonomy.cdm.model.common.IIdentifiableEntity;
25
import eu.etaxonomy.cdm.model.common.LSID;
26
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
27
import eu.etaxonomy.cdm.test.integration.CdmIntegrationTest;
28
import eu.etaxonomy.cdm.test.integration.CdmTransactionalIntegrationTest;
29

    
30
@DataSet("LSIDAuthorityServiceTest.testGetAvailableServices.xml")
31
public class LSIDMetadataServiceTest extends CdmTransactionalIntegrationTest {
32

    
33
	@SpringBeanByType
34
	private LSIDMetadataService lsidMetadataService;
35

    
36
	@SpringBeanByType
37
	private LSIDRegistry lsidRegistry;
38
	
39
	@SpringBeanByType
40
	private INameService nameService;
41
	
42
	private LSID lsid;
43
	
44
	@Before	
45
	public void setUp() throws Exception {
46
		
47
		lsid = new LSID("example.org", "taxonconcepts", "1", null);
48
	    ((LsidRegistryImpl)lsidRegistry).init();
49
	}
50
	
51
	@Test
52
	public void testInit()	{		
53
		assertNotNull("lsidMetadataService should exist",lsidMetadataService);
54
	} 
55
	
56
	@Test
57
	public void testGetMetadataWithKnownLSID() throws Exception {
58
		IIdentifiableEntity identifiableEntity = lsidMetadataService.getMetadata(lsid);
59
		assertNotNull("getMetadata should return an IdentifiableEntity",identifiableEntity);
60
		assertEquals("the object should have an lsid equal to the lsid supplied",lsid.getAuthority(),identifiableEntity.getLsid().getAuthority());
61
		assertEquals("the object should have an lsid equal to the lsid supplied",lsid.getNamespace(),identifiableEntity.getLsid().getNamespace());
62
		assertEquals("the object should have an lsid equal to the lsid supplied",lsid.getObject(),identifiableEntity.getLsid().getObject());
63
	}
64

    
65
}
(3-3/4)