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.util.ArrayList;
|
7
|
import java.util.List;
|
8
|
import java.util.UUID;
|
9
|
|
10
|
import org.junit.Assert;
|
11
|
|
12
|
import org.apache.log4j.Logger;
|
13
|
import org.junit.Test;
|
14
|
import org.springframework.security.core.GrantedAuthority;
|
15
|
import org.unitils.spring.annotation.SpringBeanByType;
|
16
|
|
17
|
import eu.etaxonomy.cdm.api.service.exception.ReferencedObjectUndeletableException;
|
18
|
import eu.etaxonomy.cdm.model.common.GrantedAuthorityImpl;
|
19
|
import eu.etaxonomy.cdm.model.common.Group;
|
20
|
import eu.etaxonomy.cdm.model.common.User;
|
21
|
import eu.etaxonomy.cdm.test.integration.CdmIntegrationTest;
|
22
|
|
23
|
public class GroupServiceImplTest extends CdmIntegrationTest {
|
24
|
private static final Logger logger = Logger.getLogger(GroupServiceImplTest.class);
|
25
|
|
26
|
@SpringBeanByType
|
27
|
IGroupService groupService;
|
28
|
|
29
|
@SpringBeanByType
|
30
|
IUserService userService;
|
31
|
|
32
|
|
33
|
@Test
|
34
|
public void testDeleteGroup(){
|
35
|
GrantedAuthorityImpl testAuthority = GrantedAuthorityImpl.NewInstance();
|
36
|
testAuthority.setAuthority("ADMIN_ALL");
|
37
|
Group group = Group.NewInstance("TestGroup");
|
38
|
group.addGrantedAuthority(testAuthority);
|
39
|
UUID groupUUID = groupService.saveGroup(group);
|
40
|
User user1 = User.NewInstance("TestUser1", "pwd");
|
41
|
UUID UserUUID = userService.save(user1);
|
42
|
|
43
|
groupService.delete(group);
|
44
|
|
45
|
group = groupService.find(groupUUID);
|
46
|
assertNull(group);
|
47
|
user1 = userService.find(UserUUID);
|
48
|
assertNotNull(user1);
|
49
|
|
50
|
}
|
51
|
|
52
|
}
|