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;
|
11
|
|
12
|
import java.util.UUID;
|
13
|
|
14
|
import org.apache.log4j.Logger;
|
15
|
import org.junit.Assert;
|
16
|
import org.junit.Test;
|
17
|
import org.unitils.database.annotations.Transactional;
|
18
|
import org.unitils.database.util.TransactionMode;
|
19
|
import org.unitils.dbunit.annotation.DataSet;
|
20
|
import org.unitils.dbunit.annotation.ExpectedDataSet;
|
21
|
import org.unitils.spring.annotation.SpringBeanByType;
|
22
|
|
23
|
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
24
|
import eu.etaxonomy.cdm.test.integration.CdmTransactionalIntegrationTest;
|
25
|
|
26
|
/**
|
27
|
* @author a.mueller
|
28
|
*
|
29
|
*/
|
30
|
@Transactional(TransactionMode.DISABLED)
|
31
|
public class IdentifiableServiceBaseTest extends CdmTransactionalIntegrationTest {
|
32
|
private static final Logger logger = Logger.getLogger(IdentifiableServiceBaseTest.class);
|
33
|
|
34
|
|
35
|
@SpringBeanByType
|
36
|
private INameService nameService;
|
37
|
|
38
|
/****************** TESTS *****************************/
|
39
|
|
40
|
@Test
|
41
|
public final void voidTestSeriveExists(){
|
42
|
Assert.assertNotNull("Service shoulb be initialized", nameService);
|
43
|
}
|
44
|
|
45
|
|
46
|
@Test
|
47
|
@DataSet
|
48
|
@ExpectedDataSet
|
49
|
public final void testUpdateTitleCache() {
|
50
|
Assert.assertEquals("There should be 5 TaxonNames in the data set", 5, nameService.count(TaxonNameBase.class));
|
51
|
Class clazz = TaxonNameBase.class;
|
52
|
int stepSize = 2;
|
53
|
nameService.updateTitleCache(clazz, stepSize, null, null);
|
54
|
|
55
|
// TaxonNameBase name = nameService.find(UUID.fromString("5d74500b-9fd5-4d18-b9cd-cc1c8a372fec"));
|
56
|
// System.out.println(name.getRank().getLabel());
|
57
|
// setComplete();
|
58
|
// endTransaction();
|
59
|
// try {
|
60
|
// printDataSet(System.out, new String[]{"TaxonNameBase","DefinedTermBase"});
|
61
|
//// printDataSet(new FileOutputStream("C:\\tmp\\test.xml"), new String[]{"TaxonNameBase"});
|
62
|
// } catch(Exception e) {
|
63
|
// logger.warn(e);
|
64
|
// }
|
65
|
|
66
|
}
|
67
|
|
68
|
|
69
|
public static Logger getLogger() {
|
70
|
return logger;
|
71
|
}
|
72
|
}
|