Search in sources :

Example 26 with MifosUserBuilder

use of org.mifos.builders.MifosUserBuilder in project head by mifos.

the class SavingsClosureActionStrutsTest method setUp.

@Before
public void setUp() throws Exception {
    userContext = TestUtils.makeUser();
    addRequestParameter("recordLoanOfficerId", "1");
    addRequestParameter("recordOfficeId", "1");
    request.getSession().setAttribute(Constants.USER_CONTEXT_KEY, userContext);
    request.getSession(false).setAttribute("ActivityContext", TestObjectFactory.getActivityContext());
    flowKey = createFlow(request, SavingsClosureAction.class);
    request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    SecurityContext securityContext = new SecurityContextImpl();
    MifosUser principal = new MifosUserBuilder().build();
    Authentication authentication = new TestingAuthenticationToken(principal, principal);
    securityContext.setAuthentication(authentication);
    SecurityContextHolder.setContext(securityContext);
}
Also used : SecurityContextImpl(org.springframework.security.core.context.SecurityContextImpl) 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 27 with MifosUserBuilder

use of org.mifos.builders.MifosUserBuilder in project head by mifos.

the class CenterActionStrutsTest method setNonLoanOfficerMifosUser.

private void setNonLoanOfficerMifosUser() {
    SecurityContext securityContext = new SecurityContextImpl();
    MifosUser principal = new MifosUserBuilder().nonLoanOfficer().build();
    Authentication authentication = new TestingAuthenticationToken(principal, principal);
    securityContext.setAuthentication(authentication);
    SecurityContextHolder.setContext(securityContext);
}
Also used : SecurityContextImpl(org.springframework.security.core.context.SecurityContextImpl) 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)

Example 28 with MifosUserBuilder

use of org.mifos.builders.MifosUserBuilder in project head by mifos.

the class AspectJApprovalInterceptorTest method init.

@BeforeClass
public static void init() {
    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) 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) BeforeClass(org.junit.BeforeClass)

Example 29 with MifosUserBuilder

use of org.mifos.builders.MifosUserBuilder in project head by mifos.

the class ApprovalServiceTest method init.

@BeforeClass
public static void init() {
    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) 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) BeforeClass(org.junit.BeforeClass)

Aggregations

MifosUserBuilder (org.mifos.builders.MifosUserBuilder)29 MifosUser (org.mifos.security.MifosUser)29 Authentication (org.springframework.security.core.Authentication)29 SecurityContext (org.springframework.security.core.context.SecurityContext)29 SecurityContextImpl (org.springframework.security.core.context.SecurityContextImpl)29 TestingAuthenticationToken (org.springframework.security.authentication.TestingAuthenticationToken)28 Before (org.junit.Before)13 Test (org.junit.Test)8 ArrayList (java.util.ArrayList)5 MeetingBO (org.mifos.application.meeting.business.MeetingBO)5 Money (org.mifos.framework.util.helpers.Money)4 BigDecimal (java.math.BigDecimal)3 Date (java.util.Date)3 Locale (java.util.Locale)3 LocalDate (org.joda.time.LocalDate)3 BeforeClass (org.junit.BeforeClass)3 AmountFeeBO (org.mifos.accounts.fees.business.AmountFeeBO)3 RecurringSchedule (org.mifos.clientportfolio.loan.service.RecurringSchedule)3 CreateLoanAccount (org.mifos.clientportfolio.newloan.applicationservice.CreateLoanAccount)3 MeetingBuilder (org.mifos.domain.builders.MeetingBuilder)3