Search in sources :

Example 6 with FieldConfig

use of org.mifos.framework.components.fieldConfiguration.util.helpers.FieldConfig in project head by mifos.

the class PersonnelSettingsActionStrutsTest method setUp.

@Before
public void setUp() throws Exception {
    userContext = TestUtils.makeUser();
    request.getSession().setAttribute(Constants.USERCONTEXT, userContext);
    addRequestParameter("recordLoanOfficerId", "1");
    addRequestParameter("recordOfficeId", "1");
    ActivityContext ac = new ActivityContext((short) 0, userContext.getBranchId().shortValue(), userContext.getId().shortValue());
    request.getSession(false).setAttribute("ActivityContext", ac);
    flowKey = createFlow(request, PersonnelSettingsAction.class);
    EntityMasterData.getInstance().init();
    FieldConfig fieldConfig = FieldConfig.getInstance();
    fieldConfig.init();
    getActionServlet().getServletContext().setAttribute(Constants.FIELD_CONFIGURATION, fieldConfig.getEntityMandatoryFieldMap());
    request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    addRequestParameter("input", "CreateUser");
    PersonnelBusinessService personnelBusinessService = new PersonnelBusinessService();
    SessionUtils.setAttribute(PersonnelConstants.OFFICE, personnelBusinessService.getOffice(TestObjectFactory.HEAD_OFFICE), request);
    SessionUtils.setCollectionAttribute(PersonnelConstants.ROLES_LIST, personnelBusinessService.getRoles(), request);
    SessionUtils.setCollectionAttribute(PersonnelConstants.ROLEMASTERLIST, personnelBusinessService.getRoles(), request);
    personnelBusinessService = null;
}
Also used : ActivityContext(org.mifos.security.util.ActivityContext) PersonnelBusinessService(org.mifos.customers.personnel.business.service.PersonnelBusinessService) FieldConfig(org.mifos.framework.components.fieldConfiguration.util.helpers.FieldConfig) Before(org.junit.Before)

Example 7 with FieldConfig

use of org.mifos.framework.components.fieldConfiguration.util.helpers.FieldConfig in project head by mifos.

the class GroupActionStrutsTest method setUp.

@Before
public void setUp() throws Exception {
    userContext = TestObjectFactory.getContext();
    request.getSession().setAttribute(Constants.USERCONTEXT, userContext);
    addRequestParameter("recordLoanOfficerId", "1");
    addRequestParameter("recordOfficeId", "1");
    request.getSession(false).setAttribute("ActivityContext", TestObjectFactory.getActivityContext());
    flowKey = createFlow(request, GroupCustAction.class);
    EntityMasterData.getInstance().init();
    FieldConfig fieldConfig = FieldConfig.getInstance();
    fieldConfig.init();
    getActionServlet().getServletContext().setAttribute(Constants.FIELD_CONFIGURATION, fieldConfig.getEntityMandatoryFieldMap());
    SecurityContext securityContext = new SecurityContextImpl();
    MifosUser principal = new MifosUserBuilder().nonLoanOfficer().withAdminRole().build();
    Authentication authentication = new TestingAuthenticationToken(principal, principal);
    securityContext.setAuthentication(authentication);
    SecurityContextHolder.setContext(securityContext);
}
Also used : SecurityContextImpl(org.springframework.security.core.context.SecurityContextImpl) FieldConfig(org.mifos.framework.components.fieldConfiguration.util.helpers.FieldConfig) Authentication(org.springframework.security.core.Authentication) SecurityContext(org.springframework.security.core.context.SecurityContext) MifosUser(org.mifos.security.MifosUser) MifosUserBuilder(org.mifos.builders.MifosUserBuilder) TestingAuthenticationToken(org.springframework.security.authentication.TestingAuthenticationToken) Before(org.junit.Before)

Example 8 with FieldConfig

use of org.mifos.framework.components.fieldConfiguration.util.helpers.FieldConfig in project head by mifos.

the class CenterActionStrutsTest method setUp.

@Before
public void setUp() throws Exception {
    UserContext userContext = TestObjectFactory.getContext();
    request.getSession().setAttribute(Constants.USERCONTEXT, userContext);
    addRequestParameter("recordLoanOfficerId", "1");
    addRequestParameter("recordOfficeId", "1");
    request.getSession(false).setAttribute("ActivityContext", TestObjectFactory.getActivityContext());
    flowKey = createFlow(request, CenterCustAction.class);
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
    EntityMasterData.getInstance().init();
    FieldConfig fieldConfig = FieldConfig.getInstance();
    fieldConfig.init();
    getActionServlet().getServletContext().setAttribute(Constants.FIELD_CONFIGURATION, fieldConfig.getEntityMandatoryFieldMap());
}
Also used : UserContext(org.mifos.security.util.UserContext) FieldConfig(org.mifos.framework.components.fieldConfiguration.util.helpers.FieldConfig) Before(org.junit.Before)

Aggregations

FieldConfig (org.mifos.framework.components.fieldConfiguration.util.helpers.FieldConfig)8 Before (org.junit.Before)5 MifosUserBuilder (org.mifos.builders.MifosUserBuilder)2 PersonnelBusinessService (org.mifos.customers.personnel.business.service.PersonnelBusinessService)2 MifosUser (org.mifos.security.MifosUser)2 ActivityContext (org.mifos.security.util.ActivityContext)2 TestingAuthenticationToken (org.springframework.security.authentication.TestingAuthenticationToken)2 Authentication (org.springframework.security.core.Authentication)2 SecurityContext (org.springframework.security.core.context.SecurityContext)2 SecurityContextImpl (org.springframework.security.core.context.SecurityContextImpl)2 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 Iterator (java.util.Iterator)1 Locale (java.util.Locale)1 HSSFRichTextString (org.apache.poi.hssf.usermodel.HSSFRichTextString)1 HSSFRow (org.apache.poi.hssf.usermodel.HSSFRow)1 HSSFSheet (org.apache.poi.hssf.usermodel.HSSFSheet)1 HSSFWorkbook (org.apache.poi.hssf.usermodel.HSSFWorkbook)1 LocalDate (org.joda.time.LocalDate)1