Revision 2638be38
Added by Andreas Müller over 8 years ago
cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/lsid/LSIDDataServiceTest.java | ||
---|---|---|
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.assertNotNull; |
|
13 |
import static org.junit.Assert.assertNull; |
|
14 |
|
|
15 |
import java.io.FileNotFoundException; |
|
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 com.ibm.lsid.server.LSIDServerException; |
|
23 |
|
|
24 |
import eu.etaxonomy.cdm.api.service.lsid.impl.LsidRegistryImpl; |
|
25 |
import eu.etaxonomy.cdm.model.common.LSID; |
|
26 |
import eu.etaxonomy.cdm.test.integration.CdmIntegrationTest; |
|
27 |
import eu.etaxonomy.cdm.test.integration.CdmTransactionalIntegrationTest; |
|
28 |
|
|
29 |
@DataSet("LSIDAuthorityServiceTest.testGetAvailableServices.xml") |
|
30 |
public class LSIDDataServiceTest extends CdmTransactionalIntegrationTest { |
|
31 |
@SpringBeanByType |
|
32 |
private LSIDDataService lsidDataService; |
|
33 |
|
|
34 |
@SpringBeanByType |
|
35 |
private LSIDRegistry lsidRegistry; |
|
36 |
|
|
37 |
private LSID knownLsid; |
|
38 |
private LSID unknownLsid; |
|
39 |
|
|
40 |
@Before |
|
41 |
public void setUp() throws Exception { |
|
42 |
unknownLsid = new LSID("fred.org", "dagg", "1", null); |
|
43 |
knownLsid = new LSID("example.org", "taxonconcepts", "1", null); |
|
44 |
((LsidRegistryImpl)lsidRegistry).init(); |
|
45 |
} |
|
46 |
|
|
47 |
@Test |
|
48 |
public void testInit() { |
|
49 |
assertNotNull("lsidDataService should exist",lsidDataService); |
|
50 |
} |
|
51 |
|
|
52 |
@Test |
|
53 |
public void testGetDataWithKnownLSID() throws Exception { |
|
54 |
commitAndStartNewTransaction(null); |
|
55 |
Object object = lsidDataService.getData(knownLsid); |
|
56 |
assertNull("getData should return a null response",object); |
|
57 |
} |
|
58 |
|
|
59 |
@Test(expected = LSIDServerException.class) |
|
60 |
public void testGetDataUnknownLSID() throws Exception { |
|
61 |
lsidDataService.getData(unknownLsid); |
|
62 |
} |
|
63 |
|
|
64 |
/* (non-Javadoc) |
|
65 |
* @see eu.etaxonomy.cdm.test.integration.CdmIntegrationTest#createTestData() |
|
66 |
*/ |
|
67 |
@Override |
|
68 |
public void createTestDataSet() throws FileNotFoundException { |
|
69 |
// TODO Auto-generated method stub |
|
70 |
|
|
71 |
} |
|
72 |
} |
|
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.assertNotNull; |
|
13 |
import static org.junit.Assert.assertNull; |
|
14 |
|
|
15 |
import java.io.FileNotFoundException; |
|
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 com.ibm.lsid.server.LSIDServerException; |
|
23 |
|
|
24 |
import eu.etaxonomy.cdm.api.service.lsid.impl.LsidRegistryImpl; |
|
25 |
import eu.etaxonomy.cdm.model.common.LSID; |
|
26 |
import eu.etaxonomy.cdm.test.integration.CdmTransactionalIntegrationTest; |
|
27 |
|
|
28 |
@DataSet("LSIDAuthorityServiceTest.testGetAvailableServices.xml") |
|
29 |
public class LSIDDataServiceTest extends CdmTransactionalIntegrationTest { |
|
30 |
@SpringBeanByType |
|
31 |
private LSIDDataService lsidDataService; |
|
32 |
|
|
33 |
@SpringBeanByType |
|
34 |
private LSIDRegistry lsidRegistry; |
|
35 |
|
|
36 |
private LSID knownLsid; |
|
37 |
private LSID unknownLsid; |
|
38 |
|
|
39 |
@Before |
|
40 |
public void setUp() throws Exception { |
|
41 |
unknownLsid = new LSID("fred.org", "dagg", "1", null); |
|
42 |
knownLsid = new LSID("example.org", "taxonconcepts", "1", null); |
|
43 |
((LsidRegistryImpl)lsidRegistry).init(); |
|
44 |
} |
|
45 |
|
|
46 |
@Test |
|
47 |
public void testInit() { |
|
48 |
assertNotNull("lsidDataService should exist",lsidDataService); |
|
49 |
} |
|
50 |
|
|
51 |
@Test |
|
52 |
public void testGetDataWithKnownLSID() throws Exception { |
|
53 |
commitAndStartNewTransaction(null); |
|
54 |
Object object = lsidDataService.getData(knownLsid); |
|
55 |
assertNull("getData should return a null response",object); |
|
56 |
} |
|
57 |
|
|
58 |
@Test(expected = LSIDServerException.class) |
|
59 |
public void testGetDataUnknownLSID() throws Exception { |
|
60 |
lsidDataService.getData(unknownLsid); |
|
61 |
} |
|
62 |
|
|
63 |
/* (non-Javadoc) |
|
64 |
* @see eu.etaxonomy.cdm.test.integration.CdmIntegrationTest#createTestData() |
|
65 |
*/ |
|
66 |
@Override |
|
67 |
public void createTestDataSet() throws FileNotFoundException { |
|
68 |
// TODO Auto-generated method stub |
|
69 |
|
|
70 |
} |
|
71 |
} |
Also available in: Unified diff
migrate to hibernate 5 for cdmlib-services and cdmlib-ext #4716