View Javadoc
1   /**
2    * Copyright 2004-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.kpme.core.role;
17  
18  import org.junit.Assert;
19  import org.junit.Before;
20  import org.junit.Test;
21  import org.kuali.kpme.core.CoreUnitTestCase;
22  import org.kuali.kpme.core.IntegrationTest;
23  import org.kuali.kpme.core.api.namespace.KPMENamespace;
24  import org.kuali.kpme.core.service.HrServiceLocator;
25  import org.kuali.rice.kim.api.role.RoleService;
26  
27  @IntegrationTest
28  public class KpmeRoleTest extends CoreUnitTestCase {
29  	
30  	private RoleService roleService;
31  	
32  	@Before
33      public void setUp() throws Exception {
34         super.setUp();
35         roleService = HrServiceLocator.getService("kimRoleService");
36      }
37  	
38  	@Test
39  	public void testGetPositionRoles() {
40  		
41  		// Test roles in KPME-PM name space
42  		String roleId = roleService.getRoleIdByNamespaceCodeAndName(KPMENamespace.KPME_PM.getNamespaceCode(), KPMERole.POSITION_SYSTEM_ADMINISTRATOR.getRoleName());
43  		Assert.assertNotNull(roleId);
44  		roleId = roleService.getRoleIdByNamespaceCodeAndName(KPMENamespace.KPME_PM.getNamespaceCode(), KPMERole.POSITION_SYSTEM_VIEW_ONLY.getRoleName());
45  		Assert.assertNotNull(roleId);
46  		
47  		// Test roles in KPME_HR name space
48  		roleId = roleService.getRoleIdByNamespaceCodeAndName(KPMENamespace.KPME_HR.getNamespaceCode(), KPMERole.KOHR_INSTITUTION_ADMINISTRATOR.getRoleName());
49  		Assert.assertNotNull(roleId);
50  		roleId = roleService.getRoleIdByNamespaceCodeAndName(KPMENamespace.KPME_HR.getNamespaceCode(), KPMERole.KOHR_ACADEMIC_HR_ADMINISTRATOR.getRoleName());
51  		Assert.assertNotNull(roleId);
52  		roleId = roleService.getRoleIdByNamespaceCodeAndName(KPMENamespace.KPME_HR.getNamespaceCode(), KPMERole.KOHR_INSTITUTION_VIEW_ONLY.getRoleName());
53  		Assert.assertNotNull(roleId);
54  		roleId = roleService.getRoleIdByNamespaceCodeAndName(KPMENamespace.KPME_HR.getNamespaceCode(), KPMERole.KOHR_LOCATION_ADMINISTRATOR.getRoleName());
55  		Assert.assertNotNull(roleId);
56  		roleId = roleService.getRoleIdByNamespaceCodeAndName(KPMENamespace.KPME_HR.getNamespaceCode(), KPMERole.KOHR_LOCATION_VIEW_ONLY.getRoleName());
57  		Assert.assertNotNull(roleId);
58  		roleId = roleService.getRoleIdByNamespaceCodeAndName(KPMENamespace.KPME_HR.getNamespaceCode(), KPMERole.KOHR_ORG_ADMINISTRATOR.getRoleName());
59  		Assert.assertNotNull(roleId);
60  		roleId = roleService.getRoleIdByNamespaceCodeAndName(KPMENamespace.KPME_HR.getNamespaceCode(), KPMERole.KOHR_ORG_VIEW_ONLY.getRoleName());
61  		Assert.assertNotNull(roleId);
62  		roleId = roleService.getRoleIdByNamespaceCodeAndName(KPMENamespace.KPME_HR.getNamespaceCode(), KPMERole.HR_DEPARTMENT_ADMINISTRATOR.getRoleName());
63  		Assert.assertNotNull(roleId);
64  		roleId = roleService.getRoleIdByNamespaceCodeAndName(KPMENamespace.KPME_HR.getNamespaceCode(), KPMERole.HR_DEPARTMENT_VIEW_ONLY.getRoleName());
65  		Assert.assertNotNull(roleId);
66  		roleId = roleService.getRoleIdByNamespaceCodeAndName(KPMENamespace.KPME_HR.getNamespaceCode(), KPMERole.HR_INSTITUTION_APPROVER.getRoleName());
67  		Assert.assertNotNull(roleId);
68  		roleId = roleService.getRoleIdByNamespaceCodeAndName(KPMENamespace.KPME_HR.getNamespaceCode(), KPMERole.ACADEMIC_HR_INSTITUTION_APPROVER.getRoleName());
69  		Assert.assertNotNull(roleId);
70  		roleId = roleService.getRoleIdByNamespaceCodeAndName(KPMENamespace.KPME_HR.getNamespaceCode(), KPMERole.BUDGET_APPROVER.getRoleName());
71  		Assert.assertNotNull(roleId);
72  		roleId = roleService.getRoleIdByNamespaceCodeAndName(KPMENamespace.KPME_HR.getNamespaceCode(), KPMERole.PAYROLL_APPROVER.getRoleName());
73  		Assert.assertNotNull(roleId);
74  		roleId = roleService.getRoleIdByNamespaceCodeAndName(KPMENamespace.KPME_HR.getNamespaceCode(), KPMERole.HR_LOCATION_APPROVER.getRoleName());
75  		Assert.assertNotNull(roleId);
76  		roleId = roleService.getRoleIdByNamespaceCodeAndName(KPMENamespace.KPME_HR.getNamespaceCode(), KPMERole.ACADEMIC_HR_LOCATION_APPROVER.getRoleName());
77  		Assert.assertNotNull(roleId);
78  		roleId = roleService.getRoleIdByNamespaceCodeAndName(KPMENamespace.KPME_HR.getNamespaceCode(), KPMERole.FISCAL_LOCATION_APPROVER.getRoleName());
79  		Assert.assertNotNull(roleId);
80  		roleId = roleService.getRoleIdByNamespaceCodeAndName(KPMENamespace.KPME_HR.getNamespaceCode(), KPMERole.HR_ORG_APPROVER.getRoleName());
81  		Assert.assertNotNull(roleId);
82  		roleId = roleService.getRoleIdByNamespaceCodeAndName(KPMENamespace.KPME_HR.getNamespaceCode(), KPMERole.FISCAL_ORG_APPROVER.getRoleName());
83  		Assert.assertNotNull(roleId);
84  		roleId = roleService.getRoleIdByNamespaceCodeAndName(KPMENamespace.KPME_HR.getNamespaceCode(), KPMERole.DEPARTMENT_APPROVER.getRoleName());
85  		Assert.assertNotNull(roleId);
86  		roleId = roleService.getRoleIdByNamespaceCodeAndName(KPMENamespace.KPME_HR.getNamespaceCode(), KPMERole.FISCAL_DEPARTMENT_APPROVER.getRoleName());
87  		Assert.assertNotNull(roleId);
88  	}
89  
90  }