1
|
package eu.etaxonomy.cdm.api.service;
|
2
|
|
3
|
import static org.junit.Assert.assertNotNull;
|
4
|
import static org.junit.Assert.assertNull;
|
5
|
|
6
|
import java.io.FileNotFoundException;
|
7
|
import java.util.UUID;
|
8
|
|
9
|
import org.apache.log4j.Logger;
|
10
|
import org.junit.Test;
|
11
|
import org.unitils.spring.annotation.SpringBeanByType;
|
12
|
|
13
|
import eu.etaxonomy.cdm.model.common.GrantedAuthorityImpl;
|
14
|
import eu.etaxonomy.cdm.model.common.Group;
|
15
|
import eu.etaxonomy.cdm.model.common.User;
|
16
|
import eu.etaxonomy.cdm.test.integration.CdmIntegrationTest;
|
17
|
|
18
|
public class GroupServiceImplTest extends CdmIntegrationTest {
|
19
|
private static final Logger logger = Logger.getLogger(GroupServiceImplTest.class);
|
20
|
|
21
|
@SpringBeanByType
|
22
|
IGroupService groupService;
|
23
|
|
24
|
@SpringBeanByType
|
25
|
IUserService userService;
|
26
|
|
27
|
|
28
|
@Test
|
29
|
public void testDeleteGroup(){
|
30
|
GrantedAuthorityImpl testAuthority = GrantedAuthorityImpl.NewInstance();
|
31
|
testAuthority.setAuthority("ADMIN_ALL");
|
32
|
Group group = Group.NewInstance("TestGroup");
|
33
|
group.addGrantedAuthority(testAuthority);
|
34
|
UUID groupUUID = groupService.saveGroup(group);
|
35
|
User user1 = User.NewInstance("TestUser1", "pwd");
|
36
|
UUID UserUUID = userService.save(user1).getUuid();
|
37
|
|
38
|
groupService.delete(group);
|
39
|
|
40
|
group = groupService.find(groupUUID);
|
41
|
assertNull(group);
|
42
|
user1 = userService.find(UserUUID);
|
43
|
assertNotNull(user1);
|
44
|
|
45
|
}
|
46
|
|
47
|
|
48
|
/* (non-Javadoc)
|
49
|
* @see eu.etaxonomy.cdm.test.integration.CdmIntegrationTest#createTestData()
|
50
|
*/
|
51
|
@Override
|
52
|
public void createTestDataSet() throws FileNotFoundException {
|
53
|
// TODO Auto-generated method stub
|
54
|
|
55
|
}
|
56
|
|
57
|
}
|