cache update for identifiable services
[cdmlib.git] / cdmlib-services / src / test / java / eu / etaxonomy / cdm / api / service / IdentifiableServiceBaseTest.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;
11
12 import java.io.FileOutputStream;
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 testGenerateTitleCache() {
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);
54 // TaxonNameBase name = nameService.find(UUID.fromString("5d74500b-9fd5-4d18-b9cd-cc1c8a372fec"));
55 setComplete();
56 endTransaction();
57 // try {
58 // printDataSet(new FileOutputStream("C:\\tmp\\test.xml"), new String[]{"TaxonNameBase"});
59 // } catch(Exception e) {
60 // logger.warn(e);
61 // }
62
63 }
64
65
66 public static Logger getLogger() {
67 return logger;
68 }
69 }