Search in sources :

Example 1 with AppFrameworkServiceImpl

use of org.openmrs.module.appframework.service.AppFrameworkServiceImpl in project openmrs-module-mirebalais by PIH.

the class RequireUtilTest method setup.

@Before
public void setup() throws Exception {
    appFrameworkService = new AppFrameworkServiceImpl(null, null, null, null, null, null, null, null);
    doctor = new Role("Doctor");
    admin = new Role("Admin");
    Privilege enterConsultNote = new Privilege(Privileges.TASK_EMR_ENTER_CONSULT_NOTE.privilege());
    enterConsultNote.setUuid(Privileges.TASK_EMR_ENTER_CONSULT_NOTE.uuid());
    enterConsultNote.setDescription(Privileges.TASK_EMR_ENTER_CONSULT_NOTE.description());
    Privilege retroClinicalNote = new Privilege(Privileges.TASK_EMR_RETRO_CLINICAL_NOTE.privilege());
    retroClinicalNote.setUuid(Privileges.TASK_EMR_RETRO_CLINICAL_NOTE.uuid());
    retroClinicalNote.setDescription(Privileges.TASK_EMR_RETRO_CLINICAL_NOTE.description());
    Privilege retroClinicalNoteThisProviderOnly = new Privilege(Privileges.TASK_EMR_RETRO_CLINICAL_NOTE_THIS_PROVIDER_ONLY.privilege());
    retroClinicalNoteThisProviderOnly.setUuid(Privileges.TASK_EMR_RETRO_CLINICAL_NOTE_THIS_PROVIDER_ONLY.uuid());
    retroClinicalNoteThisProviderOnly.setDescription(Privileges.TASK_EMR_RETRO_CLINICAL_NOTE_THIS_PROVIDER_ONLY.description());
    doctor.addPrivilege(enterConsultNote);
    doctor.addPrivilege(retroClinicalNoteThisProviderOnly);
    admin.addPrivilege(enterConsultNote);
    admin.addPrivilege(retroClinicalNote);
    user = new User();
    user.setUsername("bobMeIn");
    user.setUuid("123-456");
    user.setSystemId("abc");
    user.setRetired(true);
    userContext = mock(UserContext.class);
    when(userContext.getAuthenticatedUser()).thenReturn(user);
    uiSessionContext = new UiSessionContext();
    uiSessionContext.setUserContext(userContext);
}
Also used : Role(org.openmrs.Role) UiSessionContext(org.openmrs.module.appui.UiSessionContext) User(org.openmrs.User) UserContext(org.openmrs.api.context.UserContext) AppFrameworkServiceImpl(org.openmrs.module.appframework.service.AppFrameworkServiceImpl) Privilege(org.openmrs.Privilege) RequireUtil.userHasPrivilege(org.openmrs.module.mirebalais.require.RequireUtil.userHasPrivilege) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)1 Privilege (org.openmrs.Privilege)1 Role (org.openmrs.Role)1 User (org.openmrs.User)1 UserContext (org.openmrs.api.context.UserContext)1 AppFrameworkServiceImpl (org.openmrs.module.appframework.service.AppFrameworkServiceImpl)1 UiSessionContext (org.openmrs.module.appui.UiSessionContext)1 RequireUtil.userHasPrivilege (org.openmrs.module.mirebalais.require.RequireUtil.userHasPrivilege)1