Project

General

Profile

Download (2.22 KB) Statistics
| Branch: | Tag: | Revision:
1 07a2162c ben.clark
/**
2
* Copyright (C) 2007 EDIT
3 bd8e017a Andreas Müller
* European Distributed Institute of Taxonomy
4 07a2162c ben.clark
* http://www.e-taxonomy.eu
5 bd8e017a Andreas Müller
*
6 07a2162c ben.clark
* 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
package eu.etaxonomy.cdm.persistence.dao.hibernate.description;
10
11 d06ba760 Patric Plitzner
import java.io.FileNotFoundException;
12 d4992817 Andreas Kohlbecker
import java.util.List;
13
import java.util.UUID;
14
15 a13c5f66 Andreas Müller
import org.junit.Assert;
16 07a2162c ben.clark
import org.junit.Before;
17
import org.junit.Test;
18
import org.unitils.dbunit.annotation.DataSet;
19
import org.unitils.spring.annotation.SpringBeanByType;
20
21 d4992817 Andreas Kohlbecker
import eu.etaxonomy.cdm.model.description.IIdentificationKey;
22
import eu.etaxonomy.cdm.model.description.MediaKey;
23
import eu.etaxonomy.cdm.model.description.PolytomousKey;
24 07a2162c ben.clark
import eu.etaxonomy.cdm.persistence.dao.description.IIdentificationKeyDao;
25
import eu.etaxonomy.cdm.test.integration.CdmIntegrationTest;
26
27
@DataSet
28
public class IdentificationKeyDaoHibernateImplTest extends CdmIntegrationTest {
29 bd8e017a Andreas Müller
30 07a2162c ben.clark
	@SpringBeanByType
31
	IIdentificationKeyDao identificationKeyDao;
32 353fbf79 Andreas Kohlbecker
33 d4992817 Andreas Kohlbecker
	UUID taxonUuid = UUID.fromString("54e767ee-894e-4540-a758-f906ecb4e2d9");
34 bd8e017a Andreas Müller
35 07a2162c ben.clark
	@Before
36
	public void setUp() {
37
	}
38 bd8e017a Andreas Müller
39 07a2162c ben.clark
	@Test
40 d4992817 Andreas Kohlbecker
	public void testList() {
41 07a2162c ben.clark
		identificationKeyDao.list(null, null, null);
42
	}
43 bd8e017a Andreas Müller
44 d4992817 Andreas Kohlbecker
	@Test
45
	public void testFindByTaxonomicScope() {
46 353fbf79 Andreas Kohlbecker
		Long count1 = identificationKeyDao.countByTaxonomicScope(taxonUuid, IIdentificationKey.class);
47 d4992817 Andreas Kohlbecker
		Assert.assertTrue(count1.equals(2l));
48 353fbf79 Andreas Kohlbecker
		List<IIdentificationKey> list1 = identificationKeyDao.findByTaxonomicScope(taxonUuid, IIdentificationKey.class, null, null, null);
49 d4992817 Andreas Kohlbecker
		Assert.assertEquals(list1.size(), 2);
50 bd8e017a Andreas Müller
51 353fbf79 Andreas Kohlbecker
		Long count2 = identificationKeyDao.countByTaxonomicScope(taxonUuid, MediaKey.class);
52 d4992817 Andreas Kohlbecker
		Assert.assertTrue(count2.equals(2l));
53 353fbf79 Andreas Kohlbecker
		List<MediaKey> list2 = identificationKeyDao.findByTaxonomicScope(taxonUuid, MediaKey.class, null, null, null);
54 d4992817 Andreas Kohlbecker
		Assert.assertEquals(list2.size(), 2);
55 bd8e017a Andreas Müller
56 353fbf79 Andreas Kohlbecker
		Long count3 = identificationKeyDao.countByTaxonomicScope(taxonUuid, PolytomousKey.class);
57 d4992817 Andreas Kohlbecker
		Assert.assertTrue(count3.equals(0l));
58 353fbf79 Andreas Kohlbecker
		List<PolytomousKey> list3 = identificationKeyDao.findByTaxonomicScope(taxonUuid, PolytomousKey.class, null, null, null);
59 d4992817 Andreas Kohlbecker
		Assert.assertEquals(list3.size(), 0);
60
	}
61 d06ba760 Patric Plitzner
62
    @Override
63 379eb203 Andreas Müller
    public void createTestDataSet() throws FileNotFoundException {}
64 07a2162c ben.clark
}