Project

General

Profile

Download (2.93 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.database;
11

    
12
import static org.junit.Assert.assertEquals;
13
import static org.junit.Assert.assertFalse;
14
import static org.junit.Assert.assertNotNull;
15
import static org.junit.Assert.assertNull;
16

    
17
import java.io.FileNotFoundException;
18

    
19
import org.junit.Ignore;
20
import org.junit.Test;
21
import org.unitils.spring.annotation.SpringApplicationContext;
22
import org.unitils.spring.annotation.SpringBeanByType;
23

    
24
import eu.etaxonomy.cdm.model.common.Language;
25
import eu.etaxonomy.cdm.model.name.Rank;
26
import eu.etaxonomy.cdm.model.term.TermVocabulary;
27
import eu.etaxonomy.cdm.test.integration.CdmIntegrationTest;
28

    
29
@Ignore
30
@SpringApplicationContext("classpath:eu/etaxonomy/cdm/applicationContext-testPersistentDataSource.xml")
31
public class PersistentTermInitializerTest extends CdmIntegrationTest {
32

    
33
	@SpringBeanByType
34
	private PersistentTermInitializer persistentTermInitializer;
35

    
36
	@Test
37
	public void testInit() {
38
		assertNotNull("TermInitializer should exist",persistentTermInitializer);
39
	}
40

    
41
//  As firstPass is not used anymore we also do not need this test
42
//	@Test
43
//	@DataSet("TermsDataSet.xml")
44
//	public void testFirstPass() {
45
//		Map<UUID, DefinedTermBase> persistedTerms = new HashMap<>();
46
//		persistentTermInitializer.firstPass(VocabularyEnum.Rank, persistedTerms);
47
//	}
48

    
49
	/**
50
	 * Test method for {@link eu.etaxonomy.cdm.model.term.DefaultTermInitializer#initialize()}.
51
	 */
52
	@Test
53
	@Ignore // does not run yet in a test suite as the Language.DEFAULT() is not null then
54
	public void testInitialize() {
55
		assertNull("At the beginning of the initialization test the default language should still be null but is not", Language.DEFAULT());
56
		persistentTermInitializer.initialize();
57
		assertNotNull("TermInitializer should exist",persistentTermInitializer);
58
		assertNotNull("TermInitializer should have initialized Language.DEFAULT",Language.DEFAULT());
59
		assertEquals("Language.DEFAULT should equal Language.ENGLISH",Language.DEFAULT(),Language.ENGLISH());
60
		TermVocabulary<Language> voc = Language.DEFAULT().getVocabulary();
61
		assertNotNull("language for language vocabulary representation was null but must be default language", voc.getRepresentation(Language.DEFAULT()));
62
	}
63

    
64
	@Ignore //please commit only with ignore
65
	@Test
66
	public void testPrintData() {
67
		printDataSet(System.out);
68
	}
69

    
70
	@Test
71
	public void testGetRepresentations() {
72
		assertNotNull("Rank.SPECIES() should not be null", Rank.SPECIES());
73
		assertFalse("Rank.SPECIES().getRepresentations() should not be empty",Rank.SPECIES().getRepresentations().isEmpty());
74
		assertEquals("Rank.SPECIES().getLabel() should return \"Species\"","Species",Rank.SPECIES().getLabel());
75

    
76
	}
77

    
78
    @Override
79
    public void createTestDataSet() throws FileNotFoundException {}
80
}
(4-4/6)