2 * Copyright (C) 2009 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.cdm
.persistence
.dao
.hibernate
.common
;
12 import static org
.junit
.Assert
.assertEquals
;
13 import static org
.junit
.Assert
.assertNotNull
;
15 import java
.io
.FileNotFoundException
;
16 import java
.util
.List
;
18 import org
.hibernate
.criterion
.Criterion
;
19 import org
.junit
.Test
;
20 import org
.unitils
.dbunit
.annotation
.DataSet
;
21 import org
.unitils
.spring
.annotation
.SpringBeanByType
;
23 import eu
.etaxonomy
.cdm
.model
.common
.Group
;
24 import eu
.etaxonomy
.cdm
.persistence
.dao
.common
.IGroupDao
;
25 import eu
.etaxonomy
.cdm
.persistence
.query
.MatchMode
;
26 import eu
.etaxonomy
.cdm
.persistence
.query
.OrderHint
;
27 import eu
.etaxonomy
.cdm
.test
.integration
.CdmTransactionalIntegrationTest
;
30 public class GroupDaoHibernateImplTest
extends CdmTransactionalIntegrationTest
{
36 public void testFindGroupByUsername() {
37 Group group
= groupDao
.findGroupByName("Admins");
39 assertNotNull("findGroupByName should return a group", group
);
40 // assertEquals("the user should have had their authorities loaded",2,group.getAuthorities().size());
44 public void findByName(){
45 String queryString
= "Admins";
46 MatchMode matchmode
= MatchMode
.ANYWHERE
;
47 List
<Criterion
> criteria
= null;
48 Integer pageSize
= null;
49 Integer pageNumber
= null;
50 List
<OrderHint
> orderHints
= null;
51 List
<String
> propertyPaths
= null;
52 List
<Group
> list
= groupDao
.findByName(queryString
, matchmode
, criteria
, pageSize
, pageNumber
, orderHints
, propertyPaths
);
54 assertNotNull("A list should be returned", list
);
55 assertEquals("2 groups should be returned", 2, list
.size());
60 * @see eu.etaxonomy.cdm.test.integration.CdmIntegrationTest#createTestData()
63 public void createTestDataSet() throws FileNotFoundException
{
64 // TODO Auto-generated method stub